Skip to content

add more testing and various improvements #4

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

Merged
merged 19 commits into from
Aug 17, 2024
Merged

add more testing and various improvements #4

merged 19 commits into from
Aug 17, 2024

Conversation

2bndy5
Copy link
Collaborator

@2bndy5 2bndy5 commented Jan 1, 2024

  • avoid making relative paths from non-project source's path (in parsing clang-tidy stdout)
  • conditionally truncate thread comment length
  • use FileObj struct to hold FormatAdvice and TidyAdvice instead of instantiating parallel arrays.
  • introduce async runtime using tokio. I'm still not sure if I'm using it correctly though.
  • start using cached deps in CI (excluding any release builds)
  • allow filtering files per clang tool

Copy link

codecov bot commented Jan 1, 2024

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

2bndy5

This comment was marked as spam.

@2bndy5 2bndy5 marked this pull request as ready for review March 20, 2024 23:12
2bndy5 added 6 commits August 13, 2024 09:48
I know I can do better, so more to come

avoid making relative paths from non-project source's path
also adjust testing CI workflow (typo & remove default option)
also encapsulate `TidyNotification`s in a `TidyAdvice` struct
@cpp-linter cpp-linter deleted a comment from sonarqubecloud bot Aug 13, 2024
@cpp-linter cpp-linter deleted a comment from sonarqubecloud bot Aug 13, 2024
@2bndy5 2bndy5 force-pushed the add-tests branch 5 times, most recently from e02a6da to 6228ebc Compare August 14, 2024 12:35
- move pre-commit local hooks into CI workflow and call org's reusable workflow
- separate CLI options into categories and add a version subcommand (to print cpp-linter version)
- consolidate cpp-linter-cli crate into cpp-linter-lib crate.
- add vscode workspace config for recommended extensions
- increment version in toml during CI runs
@2bndy5 2bndy5 force-pushed the add-tests branch 2 times, most recently from 49aa6c8 to d4b8309 Compare August 14, 2024 13:21
cleanup workflow a bit

rename test job at runtime

bump codecov action

add some tier 2 targets

put vender and cross flags into matrix
@2bndy5 2bndy5 changed the title add more testing add more testing and various improvements Aug 16, 2024
@2bndy5
Copy link
Collaborator Author

2bndy5 commented Aug 17, 2024

I also updated the help output. Notice the options are grouped according to functionality:

cpp-linter help
Usage: cpp-linter [OPTIONS] [COMMAND]

Commands:
  version  Display the cpp-linter version and exit.
  help     Print this message or the help of the given subcommand(s)

Options:
  -v, --verbosity <verbosity>  This controls the action's verbosity in the workflow's logs.
                               Supported options are defined by the `logging-level <logging-levels>`_.
                               This option does not affect the verbosity of resulting
                               thread comments or file annotations.
                                [default: info] [possible values: debug, info]
  -V, --version[=<version>]    The desired version of the clang tools to use. Accepted options are
                               strings which can be 8, 9, 10, 11, 12, 13, 14, 15, 16, 17.

                               - Set this option to a blank string (``''``) to use the
                                 platform's default installed version.
                               - This value can also be a path to where the clang tools are
                                 installed (if using a custom install location). All paths specified
                                 here are converted to absolute.
                                [default: ]
  -h, --help                   Print help (see more with '--help')

clang-tidy options:
  -p, --database <database>        The path that is used to read a compile command database.
                                   For example, it can be a CMake build directory in which a file named
                                   compile_commands.json exists (set ``CMAKE_EXPORT_COMPILE_COMMANDS`` to ``ON``).
                                   When no build path is specified, a search for compile_commands.json will be
                                   attempted through all parent paths of the first input file. See
                                   https://clang.llvm.org/docs/HowToSetupToolingForLLVM.html for an        
                                   example of setting up Clang Tooling on a source tree.
  -c, --tidy-checks <tidy-checks>  A comma-separated list of globs with optional ``-`` prefix.
                                   Globs are processed in order of appearance in the list.
                                   Globs without ``-`` prefix add checks with matching names to the set,   
                                   globs with the ``-`` prefix remove checks with matching names from the set of
                                   enabled checks. This option's value is appended to the value of the 'Checks'
                                   option in a .clang-tidy file (if any).

                                   - It is possible to disable clang-tidy entirely by setting this option to
                                     ``'-*'``.
                                   - It is also possible to rely solely on a .clang-tidy config file by    
                                     specifying this option as a blank string (``''``).

                                   See also clang-tidy docs for more info.
                                    [default: boost-*,bugprone-*,performance-*,readability-*,portability-*,modernize-*,clang-analyzer-*,cppcoreguidelines-*]
  -D, --ignore-tidy <ignore-tidy>  Similar to `--ignore` but applied exclusively to files analyzed by clang-tidy. [default: ]
  -x, --extra-arg <extra-arg>      A string of extra arguments passed to clang-tidy for use as
                                   compiler arguments. This can be specified more than once for each       
                                   additional argument. Recommend using quotes around the value and        
                                   avoid using spaces between name and value (use ``=`` instead):

                                   .. code-block:: shell

                                       cpp-linter --extra-arg="-std=c++17" --extra-arg="-Wall"

clang-format options:
  -s, --style <style>                  The style rules to use.

                                       - Set this to ``file`` to have clang-format use the closest relative
                                         .clang-format file.
                                       - Set this to a blank string (``''``) to disable using clang-format 
                                         entirely.
                                        [default: llvm]
  -M, --ignore-format <ignore-format>  Similar to `--ignore` but applied exclusively to files analyzed by clang-format. [default: ]

source options:
  -e, --extensions <extensions>
          A comma-separated list of file extensions to analyze.
           [default: c,h,C,H,cpp,hpp,cc,hh,c++,h++,cxx,hxx]
  -r, --repo-root <repo-root>
          The relative path to the repository root directory. This path is
          relative to the runner's ``GITHUB_WORKSPACE`` environment variable (or
          the current working directory if not using a CI runner).
           [default: .]
  -i, --ignore <ignore>
          Set this option with path(s) to ignore (or not ignore).

          - In the case of multiple paths, you can use `|` to separate each path.
          - There is no need to use ``./`` for each entry; a blank string (``''``)
            represents the repo-root path.
          - This can also have files, but the file's path (relative to
            the :std:option:`--repo-root`) has to be specified with the filename.
          - Submodules are automatically ignored. Hidden directories (beginning
            with a ``.``) are also ignored automatically.
          - Prefix a path with ``!`` to explicitly not ignore it. This can be
            applied to a submodule's path (if desired) but not hidden directories.
          - Glob patterns are not supported here. All asterisk characters (``*``)
            are literal.
           [default: .github|target]
  -l, --lines-changed-only <lines-changed-only>
          This controls what part of the files are analyzed.
          The following values are accepted:

          - ``false``: All lines in a file are analyzed.
          - ``true``: Only lines in the diff that contain additions are analyzed.
          - ``diff``: All lines in the diff are analyzed (including unchanged
            lines but not subtractions).
           [default: true] [possible values: true, false, diff]
  -f, --files-changed-only <files-changed-only>
          Set this option to false to analyze any source files in the repo.
          This is automatically enabled if
          :std:option:`--lines-changed-only` is enabled.

          .. note::
              The ``GITHUB_TOKEN`` should be supplied when running on a
              private repository with this option enabled, otherwise the runner
              does not not have the privilege to list the changed files for an event.

              See `Authenticating with the GITHUB_TOKEN
              <https://docs.github.com/en/actions/reference/authentication-in-a-workflow>`_
           [default: false] [possible values: true, false]

feedback options:
  -g, --thread-comments <thread-comments>
          Set this option to true to enable the use of thread comments as feedback.
          Set this to ``update`` to update an existing comment if one exists;
          the value 'true' will always delete an old comment and post a new one if necessary.

          .. note::
              To use thread comments, the ``GITHUB_TOKEN`` (provided by
              Github to each repository) must be declared as an environment
              variable.

              See `Authenticating with the GITHUB_TOKEN
              <https://docs.github.com/en/actions/reference/authentication-in-a-workflow>`_

          .. hint::
              If run on a private repository, then this feature is
              disabled because the GitHub REST API behaves
              differently for thread comments on a private repository.
           [default: false] [possible values: true, false, updated]
  -t, --no-lgtm <no-lgtm>
          Set this option to true or false to enable or disable the use of a
          thread comment that basically says 'Looks Good To Me' (when all checks pass).

          .. seealso::
              The :std:option:`--thread-comments` option also notes further implications.
           [default: true] [possible values: true, false]
  -w, --step-summary <step-summary>
          Set this option to true or false to enable or disable the use of
          a workflow step summary when the run has concluded.
           [default: false] [possible values: true, false]
  -a, --file-annotations <file-annotations>
          Set this option to false to disable the use of
          file annotations as feedback.
           [default: true] [possible values: true, false]

This also means the generated CLI doc is grouped similarly
image

@2bndy5 2bndy5 merged commit 5dbb587 into main Aug 17, 2024
60 checks passed
@2bndy5 2bndy5 deleted the add-tests branch August 17, 2024 04:05
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