marklarr / mayday

Easily add custom warnings and errors to your Xcode project's build process
MIT License
260 stars 7 forks source link

Using as a standalone tool. #14

Open nikita-leonov opened 9 years ago

nikita-leonov commented 9 years ago

I would like to use mayday as standalone tool, so I am able to run it with an xcode project and set of rules as input parameters and get errors and warning into console. In such case tool could be easily set into continuous delivery pipelines and used without any modifications of projects for non-invasive quality checks of project.

marklarr commented 9 years ago

I'm not quite sure what you're asking... You'd like to see an xcode plugin for mayday so it's easier to modify your rule set?

nikita-leonov commented 9 years ago

I would like to use as a command line tool, that does not require Xcode. Something like following:

mayday --project CoolApp.xcodeproj --rules ./rules/*

  • Warning (File: Something.m): File is 543 lines long
  • Warning (File: Something.m, Line: 120): TODO found
  • Warning (File: Something.m, Line: 122): Length of line 127 is longer than 120 characters!
kylef commented 9 years ago

I though about this too before. It doesn't necessarily need to take a project file, but instead a bunch of files so I can run it across specific files too.

$ mayday --mayfile=~/Mayfile **.{m,h,swift}
nikita-leonov commented 9 years ago

Custom files for a check is a good option as well. I am suggesting to provide a project (and optionally a target) so only files included into the particular target will be checked, but not everything.

marklarr commented 9 years ago

@nikita-leonov for running through the command-line, I think this could be achieved pretty easily with some minor additions to the codebase. It'd work a lot like mayday benchmark does https://github.com/marklarr/mayday/blob/master/lib/mayday/target_integrator.rb#L42

As for @kylef's file exclusion, that'd be great too for running as a part of a CI build or commit hook and targeting only files that have changed. We could accomplish this by just adding in a filter here https://github.com/marklarr/mayday/blob/master/lib/mayday/script_generator.rb#L46

tldr; this work should be pretty easy and I can pick it up when I have some free time, or if somebody else would like to pick it up I am open to that too :smile:

nikita-leonov commented 9 years ago

@marklarr thank you very much for your effort. It is a good point regarding checking only files that changed. I think both approaches are valuable and able to co-exists. I would not be able to take a part in dev, but would be glad to test PR as soon as it will be ready on project that I have.

erudel commented 9 years ago

I quickly added an option to run mayday from the command line: https://github.com/BuddyHOPP/mayday I'd be happy to submit a pull request if this looks OK. I would also like to add a test but I am holding it back for now because I am not able to run the specs (the Fixtures project fails to build). Comments & suggestions are welcome

EDIT: when running rspec I get:

The following build commands failed: PhaseScriptExecution Generate\ Mayday\ Flags /Users/erudel/Library/Developer/Xcode/DerivedData/Fixtures-ackhnluxxzmgadfccamcakujnqmz/Build/Intermediates/Fixtures.build/Debug-iphonesimulator/Fixtures.build/Script-127114B6B9F7077B11FC0979.sh