This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] Extend spelling for CheckOptions
ClosedPublic

Authored by njames93 on Jun 22 2022, 5:05 AM.

Details

Summary

The current way to specify CheckOptions is pretty verbose and unintuitive.
Given that the options are a dictionary it makes much more sense to treat them as such in the config files.
Example:

CheckOptions: {SomeCheck.Option: true, SomeCheck.OtherOption: 'ignore'}
# Or
CheckOptions:
  SomeCheck.Option: true
  SomeCheck.OtherOption: 'ignore'

This change will still handle the old syntax with no issue, ensuring we don't screw up users current config files.

The only observable differences are support for the new syntax and -dump=config will emit using the new syntax.

Diff Detail

Event Timeline

njames93 created this revision.Jun 22 2022, 5:05 AM
njames93 requested review of this revision.Jun 22 2022, 5:05 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 22 2022, 5:05 AM
njames93 updated this revision to Diff 439018.Jun 22 2022, 7:31 AM

Update some test files using new syntax.

I like the changes -- this is a much nicer syntax for specifying configuration options!

The only observable differences are support for the new syntax and -dump=config will emit using the new syntax.

Do you expect the behavior of -dump to cause any problems for folks using that option from a script? I can't think of any that aren't super contrived, but maybe you've got more thoughts there.

(Note, you should probably rebase your patch as it doesn't seem to apply cleaning, so there's no precommit CI happening for it.)

clang-tools-extra/clang-tidy/ClangTidyOptions.cpp
85

I'm not super tickled with IO Io so if you want to use a more descriptive name, feel free. Mostly just changing it for coding style conformance.

clang-tools-extra/docs/ReleaseNotes.rst
113

I like the changes -- this is a much nicer syntax for specifying configuration options!

The only observable differences are support for the new syntax and -dump=config will emit using the new syntax.

Do you expect the behavior of -dump to cause any problems for folks using that option from a script? I can't think of any that aren't super contrived, but maybe you've got more thoughts there.

I wouldn't expect people are using the dump-config option for any scripts, It's only really there for debugging.

(Note, you should probably rebase your patch as it doesn't seem to apply cleaning, so there's no precommit CI happening for it.)

That's your fault :) https://github.com/llvm/llvm-project/commit/bb297024fad2f6c3ccaaa6a5c3a270f73f15f3ac

njames93 updated this revision to Diff 439139.Jun 22 2022, 1:24 PM
njames93 marked an inline comment as done.

Rebased and addressed comments

aaron.ballman accepted this revision.Jun 23 2022, 9:05 AM

I like the changes -- this is a much nicer syntax for specifying configuration options!

The only observable differences are support for the new syntax and -dump=config will emit using the new syntax.

Do you expect the behavior of -dump to cause any problems for folks using that option from a script? I can't think of any that aren't super contrived, but maybe you've got more thoughts there.

I wouldn't expect people are using the dump-config option for any scripts, It's only really there for debugging.

Okay, that works for me!

(Note, you should probably rebase your patch as it doesn't seem to apply cleaning, so there's no precommit CI happening for it.)

That's your fault :) https://github.com/llvm/llvm-project/commit/bb297024fad2f6c3ccaaa6a5c3a270f73f15f3ac

Heh, sorry about that. :-)

LGTM!

This revision is now accepted and ready to land.Jun 23 2022, 9:05 AM
njames93 updated this revision to Diff 439478.Jun 23 2022, 11:28 AM

Rebase to check CI

This revision was automatically updated to reflect the committed changes.