From 4e23ee2ebf3365ec699024873d1a6de0111743cf Mon Sep 17 00:00:00 2001 From: Chin Yeung Li Date: Tue, 13 Aug 2024 13:09:26 +0800 Subject: [PATCH] Fixed #26 - Update link references of ownership from nexB to aboutcode-org and version Signed-off-by: Chin Yeung Li --- CHANGELOG.rst | 14 +++++++++++++- README.rst | 4 ++-- setup.cfg | 2 +- src/source_inspector/strings_xgettext.py | 10 ++++++---- src/source_inspector/symbols_ctags.py | 5 +++-- src/source_inspector/symbols_pygments.py | 5 +++-- src/source_inspector/symbols_tree_sitter.py | 5 +++-- tests/test_symbols_ctags.py | 2 +- tests/test_symbols_pygments.py | 17 +++++++++++------ tests/test_symbols_tree_shitter.py | 11 +++++++---- tests/test_symbols_xgettext.py | 11 +++++++---- 11 files changed, 57 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 15b4e2b..5ecbfca 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,10 +1,22 @@ Changelog ========= +v0.5.2 +------ + +- Update link references of ownership from nexB to aboutcode-org + + +v0.5.1 +------ + +- Update README with Pygments and Tree-Sitter example by @keshav-space in https://github.com/aboutcode-org/source-inspector/issues/22 +- Pin tree-sitter dependencies by @keshav-space in https://github.com/aboutcode-org/source-inspector/issues/23 + v0.5.0 ------ -- Add support to collect strings, comments and symbols from source using Pygments +- Add support to collect strings, comments and symbols from source using Pygments - Add support to collect strings and symbols from source using tree-sitter diff --git a/README.rst b/README.rst index 616aad9..87399a3 100644 --- a/README.rst +++ b/README.rst @@ -5,7 +5,7 @@ source-inspector is a set of utilities to inspect and analyze source code and collect interesting data using various tools such as code symbols, strings and comments. This is also a ScanCode-toolkit plugin. -Homepage: https://github.com/nexB/source-inspector +Homepage: https://github.com/aboutcode-org/source-inspector License: Apache-2.0 @@ -53,4 +53,4 @@ To get started: 7. Run a basic scan to collect symbols and strings using `Tree-Sitter `_, and display them as YAML on the screen:: - scancode --treesitter-symbol-and-string tests/data/symbols_ctags/test3.cpp --yaml - \ No newline at end of file + scancode --treesitter-symbol-and-string tests/data/symbols_ctags/test3.cpp --yaml - diff --git a/setup.cfg b/setup.cfg index f5532f1..65aaf4b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -6,7 +6,7 @@ license = Apache-2.0 description = source-inspector long_description = file:README.rst long_description_content_type = text/x-rst -url = https://github.com/nexB/source-inspector +url = https://github.com/aboutcode-org/source-inspector author = nexB. Inc. and others author_email = info@aboutcode.org diff --git a/src/source_inspector/strings_xgettext.py b/src/source_inspector/strings_xgettext.py index e98a0b0..64189ab 100644 --- a/src/source_inspector/strings_xgettext.py +++ b/src/source_inspector/strings_xgettext.py @@ -4,7 +4,7 @@ # ScanCode is a trademark of nexB Inc. # SPDX-License-Identifier: Apache-2.0 # See http://www.apache.org/licenses/LICENSE-2.0 for the license text. -# See https://github.com/nexB/source-inspector for support or download. +# See https://github.com/aboutcode-org/source-inspector for support or download. # See https://aboutcode.org for more information about nexB OSS projects. # @@ -43,7 +43,8 @@ class XgettextStringScannerPlugin(ScanPlugin): help="Collect source strings using xgettext.", help_group=SCAN_GROUP, sort_order=100, - conflicting_options=["treesitter_symbol_and_string", "pygments_symbol_and_string"], + conflicting_options=[ + "treesitter_symbol_and_string", "pygments_symbol_and_string"], ), ] @@ -76,7 +77,7 @@ def collect_strings(location, clean=True): cmd_loc="xgettext", args=[ # this is a trick to force getting UTF back - # see https://github.com/nexB/source-inspector/issues/14#issuecomment-2001893496 + # see https://github.com/aboutcode-org/source-inspector/issues/14#issuecomment-2001893496 '--copyright-holder="ΓΈ"', "--no-wrap", "--extract-all", @@ -138,7 +139,8 @@ def parse_po_text(po_text, drop_header=False, clean=True): _, _, line = line.partition("#: ") filename, _, _ = line.partition(":") numbers = line.replace(filename + ":", "") - numbers = [int(l) for ln in numbers.split() if (l := ln.strip())] + numbers = [int(l) + for ln in numbers.split() if (l := ln.strip())] line_numbers.extend(numbers) elif line.startswith( diff --git a/src/source_inspector/symbols_ctags.py b/src/source_inspector/symbols_ctags.py index b0ab2a7..d9114e7 100644 --- a/src/source_inspector/symbols_ctags.py +++ b/src/source_inspector/symbols_ctags.py @@ -4,7 +4,7 @@ # ScanCode is a trademark of nexB Inc. # SPDX-License-Identifier: Apache-2.0 # See http://www.apache.org/licenses/LICENSE-2.0 for the license text. -# See https://github.com/nexB/source-inspector for support or download. +# See https://github.com/aboutcode-org/source-inspector for support or download. # See https://aboutcode.org for more information about nexB OSS projects. # @@ -44,7 +44,8 @@ class CtagsSymbolScannerPlugin(ScanPlugin): help="Collect source symbols using Universal ctags.", help_group=SCAN_GROUP, sort_order=100, - conflicting_options=["treesitter_symbol_and_string", "pygments_symbol_and_string"], + conflicting_options=[ + "treesitter_symbol_and_string", "pygments_symbol_and_string"], ), ] diff --git a/src/source_inspector/symbols_pygments.py b/src/source_inspector/symbols_pygments.py index 0604a0a..42d96e3 100644 --- a/src/source_inspector/symbols_pygments.py +++ b/src/source_inspector/symbols_pygments.py @@ -4,7 +4,7 @@ # ScanCode is a trademark of nexB Inc. # SPDX-License-Identifier: Apache-2.0 # See http://www.apache.org/licenses/LICENSE-2.0 for the license text. -# See https://github.com/nexB/source-inspector for support or download. +# See https://github.com/aboutcode-org/source-inspector for support or download. # See https://aboutcode.org for more information about nexB OSS projects. # @@ -51,7 +51,8 @@ class PygmentsSymbolsAndStringScannerPlugin(ScanPlugin): help="Collect source symbols, strings and comments using pygments.", help_group=SCAN_GROUP, sort_order=100, - conflicting_options=["source_symbol", "source_string", "treesitter_symbol_and_string"], + conflicting_options=["source_symbol", + "source_string", "treesitter_symbol_and_string"], ), ] diff --git a/src/source_inspector/symbols_tree_sitter.py b/src/source_inspector/symbols_tree_sitter.py index 6f26a36..ce22f9c 100644 --- a/src/source_inspector/symbols_tree_sitter.py +++ b/src/source_inspector/symbols_tree_sitter.py @@ -4,7 +4,7 @@ # ScanCode is a trademark of nexB Inc. # SPDX-License-Identifier: Apache-2.0 # See http://www.apache.org/licenses/LICENSE-2.0 for the license text. -# See https://github.com/nexB/source-inspector for support or download. +# See https://github.com/aboutcode-org/source-inspector for support or download. # See https://aboutcode.org for more information about nexB OSS projects. # @@ -66,7 +66,8 @@ class TreeSitterSymbolAndStringScannerPlugin(ScanPlugin): help="Collect source symbols and strings using tree-sitter.", help_group=SCAN_GROUP, sort_order=100, - conflicting_options=["source_symbol", "source_string", "pygments_symbol_and_string"], + conflicting_options=["source_symbol", + "source_string", "pygments_symbol_and_string"], ), ] diff --git a/tests/test_symbols_ctags.py b/tests/test_symbols_ctags.py index d5af09c..e0da3be 100644 --- a/tests/test_symbols_ctags.py +++ b/tests/test_symbols_ctags.py @@ -4,7 +4,7 @@ # ScanCode is a trademark of nexB Inc. # SPDX-License-Identifier: Apache-2.0 # See http://www.apache.org/licenses/LICENSE-2.0 for the license text. -# See https://github.com/nexB/source_inspector for support or download. +# See https://github.com/aboutcode-org/source_inspector for support or download. # See https://aboutcode.org for more information about nexB OSS projects. # diff --git a/tests/test_symbols_pygments.py b/tests/test_symbols_pygments.py index 61ef896..ab94950 100644 --- a/tests/test_symbols_pygments.py +++ b/tests/test_symbols_pygments.py @@ -4,7 +4,7 @@ # ScanCode is a trademark of nexB Inc. # SPDX-License-Identifier: Apache-2.0 # See http://www.apache.org/licenses/LICENSE-2.0 for the license text. -# See https://github.com/nexB/source-inspector for support or download. +# See https://github.com/aboutcode-org/source-inspector for support or download. # See https://aboutcode.org for more information about nexB OSS projects. # @@ -40,24 +40,28 @@ def check_json(expected, results, regen=REGEN_TEST_FIXTURES): class TestPygmentsSymbolScannerPlugin(FileBasedTesting): - test_data_dir = os.path.join(os.path.dirname(__file__), "data/symbols_pygments") + test_data_dir = os.path.join( + os.path.dirname(__file__), "data/symbols_pygments") def test_get_tokens_basic(self): test_file = self.get_test_loc("test3.cpp") - expected_loc = self.get_test_loc("test3.cpp-expected-tokens.json", must_exist=False) + expected_loc = self.get_test_loc( + "test3.cpp-expected-tokens.json", must_exist=False) results = list(get_tokens(test_file, with_comments=True)) check_json(expected_loc, results, regen=REGEN_TEST_FIXTURES) def test_get_tokens_long(self): test_file = self.get_test_loc("if_ath.c") - expected_loc = self.get_test_loc("if_ath.c-expected-tokens.json", must_exist=False) + expected_loc = self.get_test_loc( + "if_ath.c-expected-tokens.json", must_exist=False) results = list(get_tokens(test_file, with_comments=True)) check_json(expected_loc, results, regen=REGEN_TEST_FIXTURES) def test_symbols_scanner_basic_cli_cpp(self): test_file = self.get_test_loc("test3.cpp") result_file = self.get_temp_file("json") - args = ["--pygments-symbol-and-string", test_file, "--json-pp", result_file] + args = ["--pygments-symbol-and-string", + test_file, "--json-pp", result_file] run_scan_click(args) expected_loc = self.get_test_loc("test3.cpp-expected.json") @@ -66,7 +70,8 @@ def test_symbols_scanner_basic_cli_cpp(self): def test_symbols_scanner_long_cli(self): test_file = self.get_test_loc("if_ath.c") result_file = self.get_temp_file("json") - args = ["--pygments-symbol-and-string", test_file, "--json-pp", result_file] + args = ["--pygments-symbol-and-string", + test_file, "--json-pp", result_file] run_scan_click(args) expected_loc = self.get_test_loc("if_ath.c-expected.json") diff --git a/tests/test_symbols_tree_shitter.py b/tests/test_symbols_tree_shitter.py index 52900b6..2049c63 100644 --- a/tests/test_symbols_tree_shitter.py +++ b/tests/test_symbols_tree_shitter.py @@ -4,7 +4,7 @@ # ScanCode is a trademark of nexB Inc. # SPDX-License-Identifier: Apache-2.0 # See http://www.apache.org/licenses/LICENSE-2.0 for the license text. -# See https://github.com/nexB/source-inspector for support or download. +# See https://github.com/aboutcode-org/source-inspector for support or download. # See https://aboutcode.org for more information about nexB OSS projects. # @@ -38,12 +38,14 @@ def check_json(expected, results, regen=REGEN_TEST_FIXTURES): class TestPygmentsSymbolScannerPlugin(FileBasedTesting): - test_data_dir = os.path.join(os.path.dirname(__file__), "data/symbols_tree_sitter") + test_data_dir = os.path.join(os.path.dirname( + __file__), "data/symbols_tree_sitter") def test_symbols_scanner_basic_cli_cpp(self): test_file = self.get_test_loc("test3.cpp") result_file = self.get_temp_file("json") - args = ["--treesitter-symbol-and-string", test_file, "--json-pp", result_file] + args = ["--treesitter-symbol-and-string", + test_file, "--json-pp", result_file] run_scan_click(args) expected_loc = self.get_test_loc("test3.cpp-expected.json") @@ -52,7 +54,8 @@ def test_symbols_scanner_basic_cli_cpp(self): def test_symbols_scanner_long_cli(self): test_file = self.get_test_loc("if_ath.c") result_file = self.get_temp_file("json") - args = ["--treesitter-symbol-and-string", test_file, "--json-pp", result_file] + args = ["--treesitter-symbol-and-string", + test_file, "--json-pp", result_file] run_scan_click(args) expected_loc = self.get_test_loc("if_ath.c-expected.json") diff --git a/tests/test_symbols_xgettext.py b/tests/test_symbols_xgettext.py index 6524603..280b234 100644 --- a/tests/test_symbols_xgettext.py +++ b/tests/test_symbols_xgettext.py @@ -4,7 +4,7 @@ # ScanCode is a trademark of nexB Inc. # SPDX-License-Identifier: Apache-2.0 # See http://www.apache.org/licenses/LICENSE-2.0 for the license text. -# See https://github.com/nexB/source_inspector for support or download. +# See https://github.com/aboutcode-org/source_inspector for support or download. # See https://aboutcode.org for more information about nexB OSS projects. # @@ -25,7 +25,8 @@ class TestXgettextSymbolScannerPlugin(FileBasedTesting): - test_data_dir = os.path.join(os.path.dirname(__file__), "data/strings_xgettext") + test_data_dir = os.path.join( + os.path.dirname(__file__), "data/strings_xgettext") def test_is_xgettext_installed(self): assert is_xgettext_installed() @@ -232,7 +233,8 @@ def test_strings_scanner_multilines_utf8(self): args = ["--source-string", test_file, "--json-pp", result_file] run_scan_click(args) - expected_loc = self.get_test_loc("lineedit.c-expected.json", must_exist=False) + expected_loc = self.get_test_loc( + "lineedit.c-expected.json", must_exist=False) check_json_scan(expected_loc, result_file, regen=REGEN_TEST_FIXTURES) @pytest.mark.skipif( @@ -247,5 +249,6 @@ def test_strings_scanner_unicode(self): args = ["--source-string", test_file, "--json-pp", result_file] run_scan_click(args) - expected_loc = self.get_test_loc("fdisk.c-expected.json", must_exist=False) + expected_loc = self.get_test_loc( + "fdisk.c-expected.json", must_exist=False) check_json_scan(expected_loc, result_file, regen=REGEN_TEST_FIXTURES)