[flang-commits] [flang] Add Flang-Tidy: A Fortran Static Analysis Tool (PR #143883)

via flang-commits flang-commits at lists.llvm.org
Thu Jun 12 05:49:47 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {darker}-->


:warning: Python code formatter, darker found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
darker --check --diff -r HEAD~1...HEAD flang/tools/docs/conf.py flang/tools/test/flang-tidy/check_flang_tidy.py flang/tools/test/lit.cfg.py
``````````

</details>

<details>
<summary>
View the diff from darker here.
</summary>

``````````diff
--- test/flang-tidy/check_flang_tidy.py	2025-06-12 11:37:10.000000 +0000
+++ test/flang-tidy/check_flang_tidy.py	2025-06-12 12:49:17.758998 +0000
@@ -104,13 +104,11 @@
 
             if not has_check_message:
                 self.expect_no_diagnosis = True
 
         if self.expect_no_diagnosis and self.has_check_messages:
-            sys.exit(
-                "%s not found in the input" % self.messages.prefix
-            )
+            sys.exit("%s not found in the input" % self.messages.prefix)
         assert self.has_check_messages or self.expect_no_diagnosis
 
     def prepare_test_inputs(self):
         cleaned_test = re.sub("// *CHECK-[A-Z0-9\\-]*:[^\r\n]*", "//", self.input_text)
         write_file(self.temp_file_name, cleaned_test)
@@ -121,12 +119,12 @@
                 "flang-tidy",
                 self.temp_file_name,
             ]
             + ["--checks=" + self.check_name]
             + self.extra_args
-            #+ ["--"]
-            #+ self.flang_extra_args
+            # + ["--"]
+            # + self.flang_extra_args
         )
         if self.expect_flang_tidy_error:
             args.insert(0, "not")
         print("Running " + repr(args) + "...")
         flang_tidy_output = try_run(args)
--- test/lit.cfg.py	2025-06-12 11:37:10.000000 +0000
+++ test/lit.cfg.py	2025-06-12 12:49:17.778699 +0000
@@ -14,19 +14,11 @@
 
 # testFormat: The test format to use to interpret tests.
 config.test_format = lit.formats.ShTest(not llvm_config.use_lit_shell)
 
 # suffixes: A list of file extensions to treat as test files.
-config.suffixes = [
-    ".f",
-    ".f90",
-    ".f95",
-    ".f03",
-    ".f08",
-    ".mod",
-    ".test"
-]
+config.suffixes = [".f", ".f90", ".f95", ".f03", ".f08", ".mod", ".test"]
 
 # Exclude 'Inputs' directories as they are for test dependencies.
 config.excludes = ["Inputs"]
 
 # test_source_root: The root path where tests are located.

``````````

</details>


https://github.com/llvm/llvm-project/pull/143883


More information about the flang-commits mailing list