mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
8e05ae5ead
The rule output logic was wrongly coded to do `"\n".join` where appending a newline to each line was the correct behavior. Also remove a leftover typo in `rcc-config.yml`.
139 lines
4.5 KiB
YAML
139 lines
4.5 KiB
YAML
#
|
|
# This file is distributed under the MIT License. See LICENSE.md for details.
|
|
#
|
|
|
|
# These can be extended and used below (write_passes and read_passes)
|
|
matchers:
|
|
c:
|
|
type: suffix_or_shebang
|
|
suffixes: ["c", "cc", "cpp", "h", "hpp"]
|
|
python:
|
|
type: suffix_or_shebang
|
|
suffixes: ["py"]
|
|
shebang: python
|
|
bash:
|
|
type: suffix_or_shebang
|
|
suffixes: ["sh"]
|
|
shebang: bash
|
|
cmake: { type: cmake_filter }
|
|
prettier:
|
|
type: suffix_or_shebang
|
|
suffixes: ["html", "js", "json", "ts", "yaml", "yml"]
|
|
all: { type: all_filter }
|
|
|
|
write_passes:
|
|
- type: ParallelCommandPass
|
|
name: clang-format
|
|
tag: c
|
|
command: ["clang-format", "-Werror", "-style=${clang_style}", "-i"]
|
|
dry_command: ["clang-format", "-Werror", "--dry-run", "-style=${clang_style}", "-i"]
|
|
- type: ParallelCommandPass
|
|
name: cmake-format
|
|
tag: cmake
|
|
command: ["cmake-format", "-l", "error", "-i"]
|
|
dry_command: ["cmake-format", "-l", "error", "--check"]
|
|
- type: SingleCommandPass
|
|
name: black
|
|
tag: python
|
|
command: ["black", "-q", "-l", "100"]
|
|
dry_command: ["black", "-q", "--diff", "-l", "100"]
|
|
- type: SingleCommandPass
|
|
name: isort
|
|
tag: python
|
|
command: ["isort", "--settings-file", "$isort_config"]
|
|
dry_command: ["isort", "--settings-file", "$isort_config", "--diff"]
|
|
- type: SingleCommandPass
|
|
name: prettier
|
|
tag: prettier
|
|
command: ["prettier", "--write", "--config", "$prettier_config", "--loglevel", "silent"]
|
|
dry_command: ["prettier", "--check", "--config", "$prettier_config", "--loglevel", "silent"]
|
|
|
|
read_passes:
|
|
- type: SingleCommandPass
|
|
name: flake8
|
|
tag: python
|
|
command: ["flake8", "--config", "$flake8_config"]
|
|
- type: MyPyPass
|
|
command:
|
|
- mypy
|
|
- --scripts-are-modules
|
|
- --ignore-missing-imports
|
|
- --no-error-summary
|
|
- --sqlite-cache
|
|
- --skip-cache-mtime-checks
|
|
- type: LicenseCheckPass
|
|
ignore_suffixes: [".txt", ".md", ".rst", ".dot"]
|
|
ignore_stems: ["LICENSE"]
|
|
ignore_pathnames:
|
|
- .gitignore
|
|
- pyproject.toml
|
|
- clang-format-style-file
|
|
- .clang-tidy
|
|
- Doxyfile.in
|
|
- type: BashPass
|
|
- # This is hardcoded to act on file tagged as "c"
|
|
type: CPPCheckPass
|
|
support_files: ["share/revng/support.c", "lib/Support/Assert.cpp"]
|
|
ignore_cpp:
|
|
paths: ["include/revng/Runtime/", "include/revng/PipelineC/"]
|
|
files:
|
|
- share/revng/support.h
|
|
- include/revng/Support/Assert.h
|
|
- include/revng/Support/ClassSentinel.h
|
|
matchers:
|
|
# Runs on all files
|
|
generic:
|
|
- name: There are lines longer than 80 characters
|
|
matcher:
|
|
type: regexes_matcher
|
|
regexes: ["^.{81,}$"]
|
|
- name: Found snippets that should not be present
|
|
matcher:
|
|
type: regexes_matcher
|
|
regexes: ['\(--> 0\)', ";;", '^\s*->.*;$', "Twine [^&]", "#pragma clang optimize off"]
|
|
- name: Found snippets that shouldn't be at the end of a line
|
|
matcher:
|
|
type: regexes_matcher
|
|
regexes: ["::$", "RegisterPass.*>$", "} else$", '\bopt\b.*>$']
|
|
- name: Includes should never use <..> except for C++ standard includes
|
|
matcher:
|
|
type: regexes_matcher
|
|
regexes: [r"^\s*#include <.*\.hpp>"]
|
|
- name: Found snippets that should never be at the beginning of a line
|
|
matcher:
|
|
type: regexes_matcher_prefix
|
|
prefix: '^\s*'
|
|
regexes:
|
|
- '\*>'
|
|
- '/[^/\*]'
|
|
- ':[^:\(]*\)'
|
|
- "=="
|
|
- '\!='
|
|
- "<[^<]"
|
|
- ">"
|
|
- ">="
|
|
- "<="
|
|
- '//\s*WIP'
|
|
- '#if\s*[01]'
|
|
# Every file except "support_files" (see above)
|
|
non_support:
|
|
- name: Use revng_{assert,check,abort,unreachable}
|
|
matcher:
|
|
type: regexes_matcher
|
|
regexes: ['\babort\(', '\bassert\(', 'assert\(false', "llvm_unreachable"]
|
|
# Every file except "ignore_cpp" (see above)
|
|
cpp: []
|
|
# As "cpp" but only if they end with ".cpp" (i.e., ignore headers)
|
|
cpp_object:
|
|
- name: Found snippets that shouldn't be at the end of a line
|
|
matcher:
|
|
type: regexes_matcher
|
|
regexes: ["<$"]
|
|
# As "cpp" but only if they end with ".h" (i.e., ".cpp" files)
|
|
header:
|
|
- name: Headers should not use static
|
|
matcher:
|
|
type: regexes_matcher
|
|
regexes: ['^static\s']
|
|
- type: WhitespaceCheckPass
|