From 885b0bca532289fcee47fffb07d7d1e66cbe91ab Mon Sep 17 00:00:00 2001 From: Chentao Yang Date: Fri, 2 Aug 2024 10:18:39 +0200 Subject: [PATCH 1/7] Update COOKBOOK.md adding pattern for --- COOKBOOK.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/COOKBOOK.md b/COOKBOOK.md index c1a6a36..77dd64a 100644 --- a/COOKBOOK.md +++ b/COOKBOOK.md @@ -7,6 +7,7 @@ A collection of recipes for reLint. Please feel free to contribute! - [Python](#python) - [Django](#django) - [HTML](#html) +- [C/C++](#cc) # Python @@ -104,3 +105,13 @@ A collection of recipes for reLint. Please feel free to contribute! You may use a CSS class instead. filePattern: .*\.(html|vue|jsx|tsx) ``` + +# C/C++ + +```yaml +- name: no line longer than 120 characters in a line (excluding comments) # by @yangcht + pattern: ' (?<=\/\*(\*(?!\/)|[^*])*\*\/(\s|\S)*\n)(?!\/\*(\s|\S)*\n)(.{120,})(?!(\s(?!\/\*)|\S(?!\/\*))*\*\/\n)' + hint: | + Please do not use more than 120 characters in codes except for comments. + filePattern: .*\.(C|cc|cxx|cpp|c++|cppm) +``` From 45ed2cb8abe4ed1e082ed9398a9f663e8bd6a904 Mon Sep 17 00:00:00 2001 From: Chentao Yang Date: Fri, 2 Aug 2024 10:20:38 +0200 Subject: [PATCH 2/7] Update COOKBOOK.md update --- COOKBOOK.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/COOKBOOK.md b/COOKBOOK.md index 77dd64a..2ca4bc1 100644 --- a/COOKBOOK.md +++ b/COOKBOOK.md @@ -110,7 +110,7 @@ A collection of recipes for reLint. Please feel free to contribute! ```yaml - name: no line longer than 120 characters in a line (excluding comments) # by @yangcht - pattern: ' (?<=\/\*(\*(?!\/)|[^*])*\*\/(\s|\S)*\n)(?!\/\*(\s|\S)*\n)(.{120,})(?!(\s(?!\/\*)|\S(?!\/\*))*\*\/\n)' + pattern: ' (? Date: Fri, 2 Aug 2024 10:20:56 +0200 Subject: [PATCH 3/7] Update COOKBOOK.md --- COOKBOOK.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/COOKBOOK.md b/COOKBOOK.md index 2ca4bc1..c1e622c 100644 --- a/COOKBOOK.md +++ b/COOKBOOK.md @@ -110,7 +110,7 @@ A collection of recipes for reLint. Please feel free to contribute! ```yaml - name: no line longer than 120 characters in a line (excluding comments) # by @yangcht - pattern: ' (? Date: Fri, 2 Aug 2024 10:26:50 +0200 Subject: [PATCH 4/7] merge Patch 1 (#1) * Update COOKBOOK.md Adding a regex example to find line-length issues of any non-comment part of the code. * Update COOKBOOK.md Fix typo. * Update config.py upgrade from re to regex to support more features. * Update parse.py upgrade to regex from re * Update linter-requirements.txt * Update COOKBOOK.md Fixing unicode issues --- linter-requirements.txt | 1 + relint/config.py | 2 +- relint/parse.py | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/linter-requirements.txt b/linter-requirements.txt index 4b8d76c..868c714 100644 --- a/linter-requirements.txt +++ b/linter-requirements.txt @@ -3,3 +3,4 @@ black==24.4.2 flake8==7.1.0 isort==5.13.2 pydocstyle[toml]==6.3.0 +regex diff --git a/relint/config.py b/relint/config.py index 38be530..9177af6 100644 --- a/relint/config.py +++ b/relint/config.py @@ -1,5 +1,5 @@ import collections -import re +import regex as re import warnings import yaml diff --git a/relint/parse.py b/relint/parse.py index 07138a6..dbee513 100644 --- a/relint/parse.py +++ b/relint/parse.py @@ -1,7 +1,7 @@ from __future__ import annotations import collections -import re +import regex as re from rich import print as rprint from rich.console import Group From 037c8a61c074fbe27f5b6d9ec978924a32b0b474 Mon Sep 17 00:00:00 2001 From: Chentao Yang Date: Wed, 7 Aug 2024 22:06:47 +0200 Subject: [PATCH 5/7] Revert changes of the import package. --- relint/config.py | 2 +- relint/parse.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/relint/config.py b/relint/config.py index 9177af6..38be530 100644 --- a/relint/config.py +++ b/relint/config.py @@ -1,5 +1,5 @@ import collections -import regex as re +import re import warnings import yaml diff --git a/relint/parse.py b/relint/parse.py index dbee513..07138a6 100644 --- a/relint/parse.py +++ b/relint/parse.py @@ -1,7 +1,7 @@ from __future__ import annotations import collections -import regex as re +import re from rich import print as rprint from rich.console import Group From e6ebb579222e36d82f76866cff15bfd807be6448 Mon Sep 17 00:00:00 2001 From: Chentao Yang Date: Wed, 7 Aug 2024 22:10:07 +0200 Subject: [PATCH 6/7] remove requirements. --- linter-requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/linter-requirements.txt b/linter-requirements.txt index 868c714..4b8d76c 100644 --- a/linter-requirements.txt +++ b/linter-requirements.txt @@ -3,4 +3,3 @@ black==24.4.2 flake8==7.1.0 isort==5.13.2 pydocstyle[toml]==6.3.0 -regex From 5f5dd54baea1cb0a5ff3f858c7e355ab07a76a2a Mon Sep 17 00:00:00 2001 From: Johannes Maron Date: Fri, 9 Aug 2024 17:50:55 +0200 Subject: [PATCH 7/7] Update COOKBOOK.md --- COOKBOOK.md | 1 + 1 file changed, 1 insertion(+) diff --git a/COOKBOOK.md b/COOKBOOK.md index c1e622c..2ab4ce1 100644 --- a/COOKBOOK.md +++ b/COOKBOOK.md @@ -109,6 +109,7 @@ A collection of recipes for reLint. Please feel free to contribute! # C/C++ ```yaml +# This rule requires you to install the extra `regex` dependency. - name: no line longer than 120 characters in a line (excluding comments) # by @yangcht pattern: '(?