Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a DisableComment Cop #18842

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

koddsson
Copy link

@koddsson koddsson commented Nov 28, 2024

Hey 👋🏻!

I wrote this rule at work where we have a very similar codebase and @MikeMcQuaid suggested that it could be useful in Homebrew as well so I essentially just copied it over here.

The rule enforces that any robocop:disable have a preceding comment that explains why the rule was disabled. This can be very useful when things are disabled for seemingly obvious reasons, but they become less and less obvious over time.

Everything looks good except for when I try to run the test I wrote, the test runner doesn't seem to find the test file 🤔. See the output log below.

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?
I feel like I'm probably holding it wrong?
 ~/src/koddsson/brew/Library/Homebrew/ [rubocops/disable_comment] brew tests --only=rubocops/disable_comment
Usage: brew tests [options]

Run Homebrew's unit and integration tests.

      --coverage                   Generate code coverage reports.
      --generic                    Run only OS-agnostic tests.
      --online                     Include tests that use the GitHub API and
                                   tests that use any of the taps for official
                                   external commands.
      --debug                      Enable debugging using ruby/debug, or
                                   surface the standard odebug output.
      --changed                    Only runs tests on files that were changed
                                   from the master branch.
      --fail-fast                  Exit early on the first failing test.
      --only                       Run only test_script_spec.rb. Appending
                                   :line_number will start at a specific
                                   line.
      --profile                    Run the test suite serially to find the n
                                   slowest tests.
      --seed                       Randomise tests with the specified value
                                   instead of a random seed.
  -d                               Display any debugging information.
  -q, --quiet                      Make some output more quiet.
  -v, --verbose                    Make some output more verbose.
  -h, --help                       Show this message.

Error: Invalid usage: The `--only` argument requires a valid file or folder name!

@koddsson
Copy link
Author

Evidently, something failed when I ran brew style as well 🤔

Good to see that the rule is working though!

@koddsson koddsson marked this pull request as draft November 28, 2024 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant