Code Monkey home page Code Monkey logo

mayday's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

mayday's Issues

Open to non-regex line-by-line features?

Hey @marklarr, thanks for Mayday. Everyone at work is loving it ;)

I was wondering if you would be open to adding line-by-line warnings and errors that are easier to use than regex, like:

# Throws a warning when "// Copyright (c)" is found on any line in a file
error_present "// Copyright (c)"

The copyright boilerplate, TODO, and FIXME are three cases in which I'd love to add a really quick warning or error but don't want to make sure my regex is correct. What do you think?

Mayday doesn't keep require

OK I'm not a big ruby fan so I kinda suck at this but I wanted to use StringScanner to, well, scan a line so I required it in my MaydayFile, using require 'strscan'. I noticed that it doesn't work tough because of the way Mayday creates the "Generate Mayday Flags".

Any workaround ?

Need to focus warnings to specific files / exclude embedded frameworks

We currently have 999+ warnings.

But the good news is, about 750 of them are being generated from third party frameworks, embedded carthage frameworks, and the like. (For example... we're getting warnings from MagicalRecord, which is included as a Pod... I think it's the shared .h files that are doing it).

We need a way to 'focus' mayday only on our project source files. I'd like to be able to avoid our test directories too, I think.

Bribe SuperMarin to show Mayday output when used with xcpretty

$ xcodebuild -workspace NSAttributedString+CCLFormat.xcworkspace -scheme Tests test | xcpretty -c
▸ Building Pods/Pods-NSAttributedString+CCLFormat [Debug]
▸ Building Pods/Pods [Debug]
▸ Building NSAttributedString+CCLFormat/Tests [Debug]
▸ Running script 'Check Pods Manifest.lock'
▸ Running script 'Copy Pods Resources'
▸ Running script 'Generate Mayday Flags'
All tests
Test Suite Tests.xctest started
NSAttributedStringTests
    ✓ testAttributedFormatString (0.007 seconds)
    ✓ testAttributedFormatStringCanFormatAttributedString (0.000 seconds)
    ✓ testAttributedFormatStringCanFormatDescription (0.000 seconds)
    ✓ testAttributedFormatStringCanFormatString (0.000 seconds)


     Executed 4 tests, with 0 failures (0 unexpected) in 0.007 (0.009) seconds

Without xcpretty I can see the following:

/Users/kylef/Projects/cocode/NSAttributedString-CCLFormat/Tests/NSAttributedString+CCLFormatTests.m:25: warning: Length of line 124 is longer than 120 characters! [Wmayday]
/Users/kylef/Projects/cocode/NSAttributedString-CCLFormat/Tests/NSAttributedString+CCLFormatTests.m:56: warning: Length of line 147 is longer than 120 characters! [Wmayday]
/Users/kylef/Projects/cocode/NSAttributedString-CCLFormat/Tests/NSAttributedString+CCLFormatTests.m:59: warning: Length of line 145 is longer than 120 characters! [Wmayday]
/Users/kylef/Projects/cocode/NSAttributedString-CCLFormat/Tests/NSAttributedString+CCLFormatTests.m:74: warning: Length of line 126 is longer than 120 characters! [Wmayday]

Using as a standalone tool.

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.

Main file loop doesn't include custom globs

When specifying a match with a custom files: ["glob"] the specified glob doesn't seem to be included in the script's output. This means that files not ending with *.{m,h,swift} are not considered.

Here's an example, when trying to specify regex for storyboards:

warning_regex "Misplaced views", /misplaced/, files: ["*.storyboard"]

The (abridged) output looks like this:

def abstract_flag_matcher_9955(file_path, file_contents)
  return unless File.fnmatch("*.storyboard", file_path)
  return if File.fnmatch("*Pods/*", file_path)

  line_number_to_warning_hash = lambda do
    lambda do |file_contents|
      hash = {}
      lines = file_contents.split("
                                  ")
      lines.each_with_index do |line, line_number| 
        message = lambda do |line|
          line =~ Regexp.new('(?-mix:YES)') ? "Misplaced views" : nil
        end
        .call(line)
        hash[line_number + 1] = message if message
      end
      hash
    end
    .call(file_contents)
  end.call

  if line_number_to_warning_hash && line_number_to_warning_hash.keys.count > 0
    final_warning_array = []
    line_number_to_warning_hash.map do |line_number, warning_str|
      final_warning_array << "#{file_path}:#{line_number}: warning: #{warning_str} [Wmayday]"
    end
    final_warning_array.join("")
  else
    false
  end
end

Dir[ENV["SRCROOT"] + "/**/*.{m,h,swift}"].each do |filename|
  # Could be a dir with .m, like Underscore.m's dir
  if (File.file?(filename))
    file = File.open(filename, 'r')
    file_contents = file.read
    abstract_flag_output = abstract_flag_matcher_9955(file.path, file_contents)
    if abstract_flag_output && true
      puts abstract_flag_output
    end
  end
end

My understanding here is that:

Dir[ENV["SRCROOT"] + "/**/*.{m,h,swift}"].each do |filename|

Will not include *.storyboard files, meaning my custom matcher will never get called.

Let me know if I'm totally off here!

Duplicate warnings/errors

If you have a target that depends on another target (such as a test target), mayday might show warnings/errors twice. A potential fix for this would be, instead of mayday generating warnings/errors for all source files underneath SRCROOT, for it to be smarter and first make sure that the source file is a part of the target that owns the build phase.

Add note_regex

Xcode has a third kind of notation, a "note." It shows up in grey (as opposed to yellow or red). It would be great to be able to create note_regex.

Use xcodeproj 0.20.0

Mayday's tests are failing with xcodeproj 0.20.0, which it needs to use to avoid having dependency conflicts with cocoapods 0.35.0.

Function settings

Hi,
Do you have another tips using your interesting mayday project ?

Like the number max of a function ?
If a function contain any comments ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.