aws-cli icon indicating copy to clipboard operation
aws-cli copied to clipboard

Support multiple linting rules

Open aemous opened this issue 1 month ago • 2 comments

Description of changes:

  • Updated interactive and auto-fix mode to support multiple linting rules. The main technical complexity with supporting multiple rules is that as we apply fixes to the script, older linter findings become stale and would need to be 'refreshed'. We avoid this problem by linting the script one-rule-at-a-time.
  • Updated Base64BinaryFormatRule so that it does not require file:// prefix in an argument value to trigger a detection. It now flags all AWS CLI commands.
  • Added PaginationRule that flags all AWS CLI commands, and adds --no-cli-paginate as a fix.
  • Replaced ScriptLinter class with utility functions. Updated their interface to let callers pass in their own AST.
  • Added save and exit mode.
  • Added tests for save-and-exit mode and the new PaginationRule.
  • Misc. refactoring for maintainability/readability.

Description of tests:

  • Ran and passed all tests.
  • Manually tested the tool in interactive and auto-fix mode on the example script, and verified correct behavior.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

aemous avatar Nov 20 '25 16:11 aemous

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 93.33%. Comparing base (7854fa9) to head (d90bfde). :warning: Report is 1 commits behind head on upgrade-linting-tool.

Additional details and impacted files
@@                  Coverage Diff                  @@
##           upgrade-linting-tool    #9859   +/-   ##
=====================================================
  Coverage                 93.33%   93.33%           
=====================================================
  Files                       209      209           
  Lines                     16807    16807           
=====================================================
  Hits                      15687    15687           
  Misses                     1120     1120           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov-commenter avatar Nov 20 '25 16:11 codecov-commenter

Just a note, the pagination linting rule should actually be based around the --no-cli-pager argument instead of the --no-paginate argument. This will be addressed in a follow-up PR, I already have the fix staged locally with the next round of changes.

aemous avatar Dec 03 '25 15:12 aemous