Projects STRLCPY criu Commits 3f8e3220
🤬
  • ■ ■ ■ ■ ■ ■
    CONTRIBUTING.md
    skipped 59 lines
    60 60  Other conventions can be learned from the source code itself. In short, make sure your new code
    61 61  looks similar to what is already there.
    62 62   
     63 +The following command can be used to automatically run a code linter for Python files (flake8), Shell scripts (shellcheck),
     64 +text spelling (codespell), and a number of CRIU-specific checks (usage of print macros and EOL whitespace for C files).
     65 + 
     66 +```
     67 + make lint
     68 +```
     69 + 
     70 +In addition, we have adopted a [clang-format configuration file](https://www.kernel.org/doc/Documentation/process/clang-format.rst)
     71 +based on the kernel source tree. However, compliance with the clang-format autoformat rules is optional. If the automatic code formatting
     72 +results in decreased readability, we may choose to ignore these errors.
     73 + 
     74 +Run the following command to check if your changes are compliant with the clang-format rules:
     75 + 
     76 +```
     77 + make indent
     78 +```
     79 + 
     80 +This command is built upon the `git-clang-format` tool and supports two options `BASE` and `OPTS`. The `BASE` option allows you to
     81 +specify a range of commits to check for coding style issues. By default, it is set to `HEAD~1`, so that only the last commit is checked.
     82 +If you are developing on top of the criu-dev branch and want to check all your commits for compliance with the clang-format rules, you
     83 +can use `BASE=origin/criu-dev`. The `OPTS` option can be used to pass additional options to `git-clang-format`. For example, if you want
     84 +to check the last *N* commits for formatting errors, without applying the changes to the codebase you can use the following command.
     85 + 
     86 +```
     87 + make indent OPTS=--diff BASE=HEAD~N
     88 +```
     89 + 
     90 +Note that for pull requests, the "Run code linter" workflow runs these checks for all commits. If a clang-format error is detected
     91 +we need to review the suggested changes and decide if they should be fixed before merging.
     92 + 
    63 93  ## Test your changes
    64 94   
    65 95  CRIU comes with an extensive test suite. To check whether your changes introduce any regressions, run
    skipped 272 lines
Please wait...
Page is in error, reload to recover