diff --git a/Makefile b/Makefile index 64531e5b..add32c98 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -UTIL_VERSION := 0.5.17 +UTIL_VERSION := 0.5.18 UTIL_NAME := codeplag PWD := $(shell pwd) diff --git a/debian/copyright.in b/debian/copyright.in index 292a0402..27b750b4 100644 --- a/debian/copyright.in +++ b/debian/copyright.in @@ -3,7 +3,7 @@ License: All files in the codeplag/* and webparsers/* are licensed under the MIT License as below. . - Copyright (c) 2021 Codeplag Development Team + Copyright (c) 2021-2025 Codeplag Development Team . Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), @@ -21,4 +21,4 @@ License: IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/locales/codeplag.pot b/locales/codeplag.pot index 4cb0de13..9777c248 100644 --- a/locales/codeplag.pot +++ b/locales/codeplag.pot @@ -5,8 +5,8 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: codeplag 0.5.13\n" -"POT-Creation-Date: 2025-02-25 22:01+0300\n" +"Project-Id-Version: codeplag 0.5.18\n" +"POT-Creation-Date: 2025-03-28 23:00+0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Artyom Semidolin\n" "Language-Team: LANGUAGE \n" @@ -56,10 +56,13 @@ msgid "Show progress of searching plagiarism." msgstr "" #: src/codeplag/codeplagcli.py:133 -msgid "Do not show check works results in the stdout." +msgid "" +"When provided '0' show all check works results in the stdout. When " +"provided '1' show only new found check works results in the stdout. When " +"provided '2' do not show check works result in the stdout." msgstr "" -#: src/codeplag/codeplagcli.py:140 +#: src/codeplag/codeplagcli.py:144 msgid "" "Threshold of analyzer which classifies two work as same. If this number " "is too large, such as 99, then completely matching jobs will be found. " @@ -67,156 +70,156 @@ msgid "" "minimal similarity will be found." msgstr "" -#: src/codeplag/codeplagcli.py:154 +#: src/codeplag/codeplagcli.py:158 msgid "The maximum depth of the AST structure which play role in calculations." msgstr "" -#: src/codeplag/codeplagcli.py:161 +#: src/codeplag/codeplagcli.py:165 msgid "" "The length of N-grams generated to calculate the Jakkar coefficient. A " "long length of N-grams reduces the Jakkar coefficient because there are " "fewer equal sequences of two works." msgstr "" -#: src/codeplag/codeplagcli.py:172 +#: src/codeplag/codeplagcli.py:176 msgid "The language of help messages, generated reports, errors." msgstr "" -#: src/codeplag/codeplagcli.py:178 +#: src/codeplag/codeplagcli.py:182 msgid "" "Sets the threshold for the '{util_name}' util loggers'. Logging messages " "that are less severe than the level will be ignored." msgstr "" -#: src/codeplag/codeplagcli.py:188 +#: src/codeplag/codeplagcli.py:192 msgid "The maximum number of processes that can be used to compare works." msgstr "" -#: src/codeplag/codeplagcli.py:196 +#: src/codeplag/codeplagcli.py:200 msgid "Show the '{util_name}' util settings." msgstr "" -#: src/codeplag/codeplagcli.py:200 +#: src/codeplag/codeplagcli.py:204 msgid "Start searching similar works." msgstr "" -#: src/codeplag/codeplagcli.py:206 +#: src/codeplag/codeplagcli.py:210 msgid "Absolute or relative path to a local directories with project files." msgstr "" -#: src/codeplag/codeplagcli.py:216 +#: src/codeplag/codeplagcli.py:220 msgid "Absolute or relative path to files on a computer." msgstr "" -#: src/codeplag/codeplagcli.py:223 +#: src/codeplag/codeplagcli.py:227 msgid "" "Choose one of the following modes of searching plagiarism. The " "'many_to_many' mode may require more free memory." msgstr "" -#: src/codeplag/codeplagcli.py:234 +#: src/codeplag/codeplagcli.py:238 msgid "" "A regular expression for filtering checked works by name. Used with " "options 'directories', 'github-user' and 'github-project-folders'." msgstr "" -#: src/codeplag/codeplagcli.py:243 +#: src/codeplag/codeplagcli.py:247 msgid "Ignore the threshold when checking of works." msgstr "" -#: src/codeplag/codeplagcli.py:250 +#: src/codeplag/codeplagcli.py:254 msgid "Extension responsible for the analyzed programming language." msgstr "" -#: src/codeplag/codeplagcli.py:260 +#: src/codeplag/codeplagcli.py:264 msgid "Searching in all branches." msgstr "" -#: src/codeplag/codeplagcli.py:267 +#: src/codeplag/codeplagcli.py:271 msgid "A regular expression to filter searching repositories on GitHub." msgstr "" -#: src/codeplag/codeplagcli.py:274 +#: src/codeplag/codeplagcli.py:278 msgid "URL to file in a GitHub repository." msgstr "" -#: src/codeplag/codeplagcli.py:280 +#: src/codeplag/codeplagcli.py:284 msgid "GitHub organization/user name." msgstr "" -#: src/codeplag/codeplagcli.py:287 +#: src/codeplag/codeplagcli.py:291 msgid "URL to a GitHub project folder." msgstr "" -#: src/codeplag/codeplagcli.py:297 +#: src/codeplag/codeplagcli.py:301 msgid "" "Handling generated by the {util_name} reports as creating html report " "file or show it on console." msgstr "" -#: src/codeplag/codeplagcli.py:305 +#: src/codeplag/codeplagcli.py:309 msgid "Report commands of the '{util_name}' util." msgstr "" -#: src/codeplag/codeplagcli.py:314 +#: src/codeplag/codeplagcli.py:318 msgid "Generate general report from created some time ago report files." msgstr "" -#: src/codeplag/codeplagcli.py:319 +#: src/codeplag/codeplagcli.py:323 msgid "" "Path to save generated report. If it's a directory, then create a file in" " it." msgstr "" -#: src/codeplag/codeplagcli.py:328 +#: src/codeplag/codeplagcli.py:332 msgid "Type of the created report file." msgstr "" -#: src/codeplag/codeplagcli.py:336 +#: src/codeplag/codeplagcli.py:340 msgid "" "Path to first compared works. Can be path to directory or URL to the " "project folder." msgstr "" -#: src/codeplag/codeplagcli.py:346 +#: src/codeplag/codeplagcli.py:350 msgid "" "Path to second compared works. Can be path to directory or URL to the " "project folder." msgstr "" -#: src/codeplag/codeplagcli.py:358 +#: src/codeplag/codeplagcli.py:362 msgid "" "Program help to find similar parts of source codes for the different " "languages." msgstr "" -#: src/codeplag/codeplagcli.py:365 +#: src/codeplag/codeplagcli.py:369 msgid "Print current version number and exit." msgstr "" -#: src/codeplag/codeplagcli.py:371 +#: src/codeplag/codeplagcli.py:375 msgid "Commands help." msgstr "" -#: src/codeplag/codeplagcli.py:386 +#: src/codeplag/codeplagcli.py:390 msgid "No command is provided; please choose one from the available (--help)." msgstr "" -#: src/codeplag/codeplagcli.py:397 +#: src/codeplag/codeplagcli.py:401 msgid "There is nothing to modify; please provide at least one argument." msgstr "" -#: src/codeplag/codeplagcli.py:401 +#: src/codeplag/codeplagcli.py:405 msgid "The'repo-regexp' option requires the provided 'github-user' option." msgstr "" -#: src/codeplag/codeplagcli.py:409 +#: src/codeplag/codeplagcli.py:413 msgid "" "The'path-regexp' option requires the provided 'directories', 'github-" "user', or 'github-project-folder' options." msgstr "" -#: src/codeplag/codeplagcli.py:420 src/codeplag/handlers/report.py:95 +#: src/codeplag/codeplagcli.py:424 src/codeplag/handlers/report.py:95 msgid "All paths must be provided." msgstr "" diff --git a/locales/translations/en/LC_MESSAGES/codeplag.po b/locales/translations/en/LC_MESSAGES/codeplag.po index 95f8b3c9..0bd42c5a 100644 --- a/locales/translations/en/LC_MESSAGES/codeplag.po +++ b/locales/translations/en/LC_MESSAGES/codeplag.po @@ -4,9 +4,9 @@ # msgid "" msgstr "" -"Project-Id-Version: codeplag 0.5.13\n" +"Project-Id-Version: codeplag 0.5.18\n" "POT-Creation-Date: 2024-05-21 09:28+0300\n" -"PO-Revision-Date: 2024-05-16 19:15+0300\n" +"PO-Revision-Date: 2025-03-28 12:05+0300\n" "Last-Translator: Artyom Semidolin\n" "Language: en\n" "Language-Team: en \n" @@ -57,10 +57,16 @@ msgid "Show progress of searching plagiarism." msgstr "Show progress of searching plagiarism." #: src/codeplag/codeplagcli.py:133 -msgid "Do not show check works results in the stdout." -msgstr "Do not show check works results in the stdout." +msgid "" +"When provided '0' show all check works results in the stdout. When " +"provided '1' show only new found check works results in the stdout. When " +"provided '2' do not show check works result in the stdout." +msgstr "" +"When provided '0' show all check works results in the stdout. When " +"provided '1' show only new found check works results in the stdout. When " +"provided '2' do not show check works result in the stdout." -#: src/codeplag/codeplagcli.py:140 +#: src/codeplag/codeplagcli.py:144 msgid "" "Threshold of analyzer which classifies two work as same. If this number " "is too large, such as 99, then completely matching jobs will be found. " @@ -72,11 +78,11 @@ msgstr "" "Otherwise, if this number is small, such as 50, then all work with " "minimal similarity will be found." -#: src/codeplag/codeplagcli.py:154 +#: src/codeplag/codeplagcli.py:158 msgid "The maximum depth of the AST structure which play role in calculations." msgstr "The maximum depth of the AST structure which play role in calculations." -#: src/codeplag/codeplagcli.py:161 +#: src/codeplag/codeplagcli.py:165 msgid "" "The length of N-grams generated to calculate the Jakkar coefficient. A " "long length of N-grams reduces the Jakkar coefficient because there are " @@ -86,11 +92,11 @@ msgstr "" "long length of N-grams reduces the Jakkar coefficient because there are " "fewer equal sequences of two works." -#: src/codeplag/codeplagcli.py:172 +#: src/codeplag/codeplagcli.py:176 msgid "The language of help messages, generated reports, errors." msgstr "The language of help messages, generated reports, errors." -#: src/codeplag/codeplagcli.py:178 +#: src/codeplag/codeplagcli.py:182 msgid "" "Sets the threshold for the '{util_name}' util loggers'. Logging messages " "that are less severe than the level will be ignored." @@ -98,27 +104,27 @@ msgstr "" "Sets the threshold for the '{util_name}' util loggers'. Logging messages " "that are less severe than the level will be ignored." -#: src/codeplag/codeplagcli.py:188 +#: src/codeplag/codeplagcli.py:192 msgid "The maximum number of processes that can be used to compare works." msgstr "The maximum number of processes that can be used to compare works." -#: src/codeplag/codeplagcli.py:196 +#: src/codeplag/codeplagcli.py:200 msgid "Show the '{util_name}' util settings." msgstr "Show the '{util_name}' util settings." -#: src/codeplag/codeplagcli.py:200 +#: src/codeplag/codeplagcli.py:204 msgid "Start searching similar works." msgstr "Start searching similar works." -#: src/codeplag/codeplagcli.py:206 +#: src/codeplag/codeplagcli.py:210 msgid "Absolute or relative path to a local directories with project files." msgstr "Absolute or relative path to a local directories with project files." -#: src/codeplag/codeplagcli.py:216 +#: src/codeplag/codeplagcli.py:220 msgid "Absolute or relative path to files on a computer." msgstr "Absolute or relative path to files on a computer." -#: src/codeplag/codeplagcli.py:223 +#: src/codeplag/codeplagcli.py:227 msgid "" "Choose one of the following modes of searching plagiarism. The " "'many_to_many' mode may require more free memory." @@ -126,7 +132,7 @@ msgstr "" "Choose one of the following modes of searching plagiarism. The " "'many_to_many' mode may require more free memory." -#: src/codeplag/codeplagcli.py:234 +#: src/codeplag/codeplagcli.py:238 msgid "" "A regular expression for filtering checked works by name. Used with " "options 'directories', 'github-user' and 'github-project-folders'." @@ -134,35 +140,35 @@ msgstr "" "A regular expression for filtering checked works by name. Used with " "options 'directories', 'github-user' and 'github-project-folders'." -#: src/codeplag/codeplagcli.py:243 +#: src/codeplag/codeplagcli.py:247 msgid "Ignore the threshold when checking of works." msgstr "Ignore the threshold when checking of works." -#: src/codeplag/codeplagcli.py:250 +#: src/codeplag/codeplagcli.py:254 msgid "Extension responsible for the analyzed programming language." msgstr "Extension responsible for the analyzed programming language." -#: src/codeplag/codeplagcli.py:260 +#: src/codeplag/codeplagcli.py:264 msgid "Searching in all branches." msgstr "Searching in all branches." -#: src/codeplag/codeplagcli.py:267 +#: src/codeplag/codeplagcli.py:271 msgid "A regular expression to filter searching repositories on GitHub." msgstr "A regular expression to filter searching repositories on GitHub." -#: src/codeplag/codeplagcli.py:274 +#: src/codeplag/codeplagcli.py:278 msgid "URL to file in a GitHub repository." msgstr "URL to file in a GitHub repository." -#: src/codeplag/codeplagcli.py:280 +#: src/codeplag/codeplagcli.py:284 msgid "GitHub organization/user name." msgstr "GitHub organization/user name." -#: src/codeplag/codeplagcli.py:287 +#: src/codeplag/codeplagcli.py:291 msgid "URL to a GitHub project folder." msgstr "URL to a GitHub project folder." -#: src/codeplag/codeplagcli.py:297 +#: src/codeplag/codeplagcli.py:301 msgid "" "Handling generated by the {util_name} reports as creating html report " "file or show it on console." @@ -170,15 +176,15 @@ msgstr "" "Handling generated by the {util_name} reports as creating html report " "file or show it on console." -#: src/codeplag/codeplagcli.py:305 +#: src/codeplag/codeplagcli.py:309 msgid "Report commands of the '{util_name}' util." msgstr "Report commands of the '{util_name}' util." -#: src/codeplag/codeplagcli.py:314 +#: src/codeplag/codeplagcli.py:318 msgid "Generate general report from created some time ago report files." msgstr "Generate general report from created some time ago report files." -#: src/codeplag/codeplagcli.py:319 +#: src/codeplag/codeplagcli.py:323 msgid "" "Path to save generated report. If it's a directory, then create a file in" " it." @@ -186,11 +192,11 @@ msgstr "" "Path to save generated report. If it's a directory, then create a file in" " it." -#: src/codeplag/codeplagcli.py:328 +#: src/codeplag/codeplagcli.py:332 msgid "Type of the created report file." msgstr "Type of the created report file." -#: src/codeplag/codeplagcli.py:336 +#: src/codeplag/codeplagcli.py:340 msgid "" "Path to first compared works. Can be path to directory or URL to the " "project folder." @@ -198,7 +204,7 @@ msgstr "" "Path to first compared works. Can be path to directory or URL to the " "project folder." -#: src/codeplag/codeplagcli.py:346 +#: src/codeplag/codeplagcli.py:350 msgid "" "Path to second compared works. Can be path to directory or URL to the " "project folder." @@ -206,7 +212,7 @@ msgstr "" "Path to second compared works. Can be path to directory or URL to the " "project folder." -#: src/codeplag/codeplagcli.py:358 +#: src/codeplag/codeplagcli.py:362 msgid "" "Program help to find similar parts of source codes for the different " "languages." @@ -214,27 +220,27 @@ msgstr "" "Program help to find similar parts of source codes for the different " "languages." -#: src/codeplag/codeplagcli.py:365 +#: src/codeplag/codeplagcli.py:369 msgid "Print current version number and exit." msgstr "Print current version number and exit." -#: src/codeplag/codeplagcli.py:371 +#: src/codeplag/codeplagcli.py:375 msgid "Commands help." msgstr "Commands help." -#: src/codeplag/codeplagcli.py:386 +#: src/codeplag/codeplagcli.py:390 msgid "No command is provided; please choose one from the available (--help)." msgstr "No command is provided; please choose one from the available (--help)." -#: src/codeplag/codeplagcli.py:397 +#: src/codeplag/codeplagcli.py:401 msgid "There is nothing to modify; please provide at least one argument." msgstr "There is nothing to modify; please provide at least one argument." -#: src/codeplag/codeplagcli.py:401 +#: src/codeplag/codeplagcli.py:405 msgid "The'repo-regexp' option requires the provided 'github-user' option." msgstr "The'repo-regexp' option requires the provided 'github-user' option." -#: src/codeplag/codeplagcli.py:409 +#: src/codeplag/codeplagcli.py:413 msgid "" "The'path-regexp' option requires the provided 'directories', 'github-" "user', or 'github-project-folder' options." @@ -242,7 +248,7 @@ msgstr "" "The'path-regexp' option requires the provided 'directories', 'github-" "user', or 'github-project-folder' options." -#: src/codeplag/codeplagcli.py:420 src/codeplag/handlers/report.py:95 +#: src/codeplag/codeplagcli.py:424 src/codeplag/handlers/report.py:95 msgid "All paths must be provided." msgstr "All or none of the root paths must be specified." diff --git a/locales/translations/ru/LC_MESSAGES/codeplag.po b/locales/translations/ru/LC_MESSAGES/codeplag.po index dd19af91..29c4aab6 100644 --- a/locales/translations/ru/LC_MESSAGES/codeplag.po +++ b/locales/translations/ru/LC_MESSAGES/codeplag.po @@ -4,9 +4,9 @@ # msgid "" msgstr "" -"Project-Id-Version: codeplag 0.5.13\n" +"Project-Id-Version: codeplag 0.5.18\n" "POT-Creation-Date: 2024-05-21 09:28+0300\n" -"PO-Revision-Date: 2024-05-11 12:05+0300\n" +"PO-Revision-Date: 2025-03-28 12:05+0300\n" "Last-Translator: Artyom Semidolin\n" "Language: ru\n" "Language-Team: ru \n" @@ -62,10 +62,17 @@ msgid "Show progress of searching plagiarism." msgstr "Показывать прогресс выполнения поиска схожих работ." #: src/codeplag/codeplagcli.py:133 -msgid "Do not show check works results in the stdout." -msgstr "Не показывать результаты проверки в stdout." +msgid "" +"When provided '0' show all check works results in the stdout. When " +"provided '1' show only new found check works results in the stdout. When " +"provided '2' do not show check works result in the stdout." +msgstr "" +"При заданном значении '0' показывать в stdout все результаты проверок. " +"При заданном значении '1' показывать в stdout только новые найденные " +"результаты проверок. При заданном значении '2' не показывать результаты " +"проверок в stdout." -#: src/codeplag/codeplagcli.py:140 +#: src/codeplag/codeplagcli.py:144 msgid "" "Threshold of analyzer which classifies two work as same. If this number " "is too large, such as 99, then completely matching jobs will be found. " @@ -78,11 +85,11 @@ msgstr "" "будет невелико, например, 50, то будут найдены все работы с минимальным " "сходством." -#: src/codeplag/codeplagcli.py:154 +#: src/codeplag/codeplagcli.py:158 msgid "The maximum depth of the AST structure which play role in calculations." msgstr "Максимальная глубина структуры AST, учитываемая при структурном сравнении." -#: src/codeplag/codeplagcli.py:161 +#: src/codeplag/codeplagcli.py:165 msgid "" "The length of N-grams generated to calculate the Jakkar coefficient. A " "long length of N-grams reduces the Jakkar coefficient because there are " @@ -92,11 +99,11 @@ msgstr "" "Большая длина N-грамм уменьшает коэффициент Жаккара, поскольку количество" " одинаковых последовательностей из двух работ становится меньше." -#: src/codeplag/codeplagcli.py:172 +#: src/codeplag/codeplagcli.py:176 msgid "The language of help messages, generated reports, errors." msgstr "Язык справочных сообщений, сгенерированных отчетов, ошибок." -#: src/codeplag/codeplagcli.py:178 +#: src/codeplag/codeplagcli.py:182 msgid "" "Sets the threshold for the '{util_name}' util loggers'. Logging messages " "that are less severe than the level will be ignored." @@ -105,29 +112,29 @@ msgstr "" "Сообщения, которые менее серьезны, чем это значение, будут " "игнорироваться." -#: src/codeplag/codeplagcli.py:188 +#: src/codeplag/codeplagcli.py:192 msgid "The maximum number of processes that can be used to compare works." msgstr "" "Максимальное количество процессов, которые можно задействовать для " "сравнения работ." -#: src/codeplag/codeplagcli.py:196 +#: src/codeplag/codeplagcli.py:200 msgid "Show the '{util_name}' util settings." msgstr "Показать настройки утилиты '{util_name}'." -#: src/codeplag/codeplagcli.py:200 +#: src/codeplag/codeplagcli.py:204 msgid "Start searching similar works." msgstr "Начать поиск схожих работ." -#: src/codeplag/codeplagcli.py:206 +#: src/codeplag/codeplagcli.py:210 msgid "Absolute or relative path to a local directories with project files." msgstr "Абсолютный или относительный путь к локальным папкам с файлами проекта." -#: src/codeplag/codeplagcli.py:216 +#: src/codeplag/codeplagcli.py:220 msgid "Absolute or relative path to files on a computer." msgstr "Абсолютный или относительный путь к файлам на компьютере." -#: src/codeplag/codeplagcli.py:223 +#: src/codeplag/codeplagcli.py:227 msgid "" "Choose one of the following modes of searching plagiarism. The " "'many_to_many' mode may require more free memory." @@ -135,7 +142,7 @@ msgstr "" "Выберите один из следующих режимов поиска схожих работ. Режим " "'many_to_many' может требовать больше свободной памяти." -#: src/codeplag/codeplagcli.py:234 +#: src/codeplag/codeplagcli.py:238 msgid "" "A regular expression for filtering checked works by name. Used with " "options 'directories', 'github-user' and 'github-project-folders'." @@ -144,35 +151,35 @@ msgstr "" "Используется с аргументами 'directories', 'github-user' или 'github-" "project-folders'." -#: src/codeplag/codeplagcli.py:243 +#: src/codeplag/codeplagcli.py:247 msgid "Ignore the threshold when checking of works." msgstr "Игнорировать пороговое значение при проверке работ." -#: src/codeplag/codeplagcli.py:250 +#: src/codeplag/codeplagcli.py:254 msgid "Extension responsible for the analyzed programming language." msgstr "Расширение проверяемых работ." -#: src/codeplag/codeplagcli.py:260 +#: src/codeplag/codeplagcli.py:264 msgid "Searching in all branches." msgstr "Поиск по всем веткам." -#: src/codeplag/codeplagcli.py:267 +#: src/codeplag/codeplagcli.py:271 msgid "A regular expression to filter searching repositories on GitHub." msgstr "Регулярное выражение для фильтрации искомых репозиториев на GitHub." -#: src/codeplag/codeplagcli.py:274 +#: src/codeplag/codeplagcli.py:278 msgid "URL to file in a GitHub repository." msgstr "URL до файла в репозитории на GitHub." -#: src/codeplag/codeplagcli.py:280 +#: src/codeplag/codeplagcli.py:284 msgid "GitHub organization/user name." msgstr "Название организации или имя пользователя на GitHub." -#: src/codeplag/codeplagcli.py:287 +#: src/codeplag/codeplagcli.py:291 msgid "URL to a GitHub project folder." msgstr "URL до какой-либо папки проекта на GitHub." -#: src/codeplag/codeplagcli.py:297 +#: src/codeplag/codeplagcli.py:301 msgid "" "Handling generated by the {util_name} reports as creating html report " "file or show it on console." @@ -180,15 +187,15 @@ msgstr "" "Обработка отчетов, сгенерированных с помощью {util_name}, в виде создания" " файла отчета в формате html или отображения его на консоли." -#: src/codeplag/codeplagcli.py:305 +#: src/codeplag/codeplagcli.py:309 msgid "Report commands of the '{util_name}' util." msgstr "Команды для работы с отчётами утилиты '{util_name}'." -#: src/codeplag/codeplagcli.py:314 +#: src/codeplag/codeplagcli.py:318 msgid "Generate general report from created some time ago report files." msgstr "Создание общего отчёта из созданных ранее файлов отчётов." -#: src/codeplag/codeplagcli.py:319 +#: src/codeplag/codeplagcli.py:323 msgid "" "Path to save generated report. If it's a directory, then create a file in" " it." @@ -196,11 +203,11 @@ msgstr "" "Путь для сохранения созданного отчёта. Если передан путь до папки, то " "создаёт отчёт в ней." -#: src/codeplag/codeplagcli.py:328 +#: src/codeplag/codeplagcli.py:332 msgid "Type of the created report file." msgstr "Тип создаваемого файла отчёта." -#: src/codeplag/codeplagcli.py:336 +#: src/codeplag/codeplagcli.py:340 msgid "" "Path to first compared works. Can be path to directory or URL to the " "project folder." @@ -208,7 +215,7 @@ msgstr "" "Путь к первым сравниваемым файлам. Это может быть путь к директории или " "URL к папке проекта." -#: src/codeplag/codeplagcli.py:346 +#: src/codeplag/codeplagcli.py:350 msgid "" "Path to second compared works. Can be path to directory or URL to the " "project folder." @@ -216,7 +223,7 @@ msgstr "" "Путь ко вторым сравниваемым файлам. Это может быть путь к директории или " "URL к папке проекта." -#: src/codeplag/codeplagcli.py:358 +#: src/codeplag/codeplagcli.py:362 msgid "" "Program help to find similar parts of source codes for the different " "languages." @@ -224,31 +231,31 @@ msgstr "" "Программа помогает находить схожие части исходных кодов для разных языков" " программирования." -#: src/codeplag/codeplagcli.py:365 +#: src/codeplag/codeplagcli.py:369 msgid "Print current version number and exit." msgstr "Выводит текущую версию программы." -#: src/codeplag/codeplagcli.py:371 +#: src/codeplag/codeplagcli.py:375 msgid "Commands help." msgstr "Справка по командам." -#: src/codeplag/codeplagcli.py:386 +#: src/codeplag/codeplagcli.py:390 msgid "No command is provided; please choose one from the available (--help)." msgstr "" "Ни одна из команд не выбрана, пожалуйста, выбери одну из доступных команд" " (--help)." -#: src/codeplag/codeplagcli.py:397 +#: src/codeplag/codeplagcli.py:401 msgid "There is nothing to modify; please provide at least one argument." msgstr "" "Нечего модифицировать, пожалуйста, выберите один из параметров для " "модификации." -#: src/codeplag/codeplagcli.py:401 +#: src/codeplag/codeplagcli.py:405 msgid "The'repo-regexp' option requires the provided 'github-user' option." msgstr "Аргумент 'repo-regexp' требует заданного параметра 'github-user'." -#: src/codeplag/codeplagcli.py:409 +#: src/codeplag/codeplagcli.py:413 msgid "" "The'path-regexp' option requires the provided 'directories', 'github-" "user', or 'github-project-folder' options." @@ -256,7 +263,7 @@ msgstr "" "Аргумент 'path-regexp' требует заданного параметра 'directories', " "'github-user' или 'github-project-folder'." -#: src/codeplag/codeplagcli.py:420 src/codeplag/handlers/report.py:95 +#: src/codeplag/codeplagcli.py:424 src/codeplag/handlers/report.py:95 msgid "All paths must be provided." msgstr "Необходимо указать все корневые пути или не указывать ни одного." diff --git a/src/codeplag/codeplagcli.py b/src/codeplag/codeplagcli.py index dc2955f1..7d904ce8 100644 --- a/src/codeplag/codeplagcli.py +++ b/src/codeplag/codeplagcli.py @@ -130,9 +130,13 @@ def __add_settings_path(self: Self, subparsers: argparse._SubParsersAction) -> N settings_modify.add_argument( "-so", "--short-output", - help=_("Do not show check works results in the stdout."), + help=_( + "When provided '0' show all check works results in the stdout. " + "When provided '1' show only new found check works results in the stdout. " + "When provided '2' do not show check works result in the stdout." + ), type=int, - choices=[0, 1], + choices=[0, 1, 2], ) settings_modify.add_argument( "-t", diff --git a/src/codeplag/config.py b/src/codeplag/config.py index 1ef1ac7b..4e3696e1 100644 --- a/src/codeplag/config.py +++ b/src/codeplag/config.py @@ -13,7 +13,7 @@ DEFAULT_WORKERS, ) from codeplag.logger import codeplag_logger as logger -from codeplag.types import Settings +from codeplag.types import Settings, ShortOutput Config = dict[str, Any] @@ -85,7 +85,7 @@ def write_settings_conf(settings: Settings) -> None: max_depth=DEFAULT_MAX_DEPTH, ngrams_length=DEFAULT_NGRAMS_LENGTH, show_progress=0, - short_output=0, + short_output=ShortOutput.SHOW_ALL, reports_extension=DEFAULT_REPORT_EXTENSION, language=DEFAULT_LANGUAGE, log_level=DEFAULT_LOG_LEVEL, diff --git a/src/codeplag/handlers/check.py b/src/codeplag/handlers/check.py index f7c39120..6f0d1c2b 100644 --- a/src/codeplag/handlers/check.py +++ b/src/codeplag/handlers/check.py @@ -45,6 +45,7 @@ Mode, NgramsLength, ProcessingWorks, + ShortOutput, Threshold, ) from webparsers.github_parser import GitHubParser @@ -91,7 +92,7 @@ def __init__( settings_conf = read_settings_conf() self.show_progress: Flag = settings_conf["show_progress"] - self.short_output: Flag = settings_conf["short_output"] + self.short_output = ShortOutput(settings_conf["short_output"]) self.threshold: Threshold | None = settings_conf["threshold"] self.workers: int = settings_conf["workers"] self.ngrams_length: NgramsLength = settings_conf.get( @@ -305,7 +306,8 @@ def _do_step( futures.add(future) processing.append(ProcessingWorks(work1, work2)) return ExitCode.EXIT_SUCCESS - self._handle_compare_result(work1, work2, metrics) + if self.short_output is ShortOutput.SHOW_ALL: + self._handle_compare_result(work1, work2, metrics) _print_pretty_progress_if_need_and_increase(self.progress, self.workers) return ExitCode.EXIT_FOUND_SIM @@ -320,7 +322,7 @@ def _handle_compare_result( return ExitCode.EXIT_SUCCESS if self.reporter and save: self.reporter.save_result(work1, work2, metrics) - if self.short_output: + if self.short_output is ShortOutput.NO_SHOW: return ExitCode.EXIT_FOUND_SIM if self.threshold and (metrics.structure.similarity * 100) <= self.threshold: diff --git a/src/codeplag/types.py b/src/codeplag/types.py index 9d8b607d..ae991016 100644 --- a/src/codeplag/types.py +++ b/src/codeplag/types.py @@ -142,12 +142,19 @@ class CLIException(Exception): class ExitCode(IntEnum): EXIT_SUCCESS = 0 EXIT_KEYBOARD = 1 + EXIT_PARSER = 2 EXIT_INVAL = 3 EXIT_UNKNOWN = 5 # Exit codes that are 200 or greater are auxiliary codes. EXIT_FOUND_SIM = 200 +class ShortOutput(IntEnum): + SHOW_ALL = 0 + SHOW_NEW = 1 + NO_SHOW = 2 + + # Misc # ---------------------------------------------------------------------------- @@ -159,7 +166,7 @@ class Settings(TypedDict): reports: NotRequired[Path] reports_extension: ReportsExtension show_progress: Flag - short_output: Flag + short_output: ShortOutput max_depth: MaxDepth ngrams_length: NgramsLength threshold: Threshold diff --git a/test/auto/functional/test_check.py b/test/auto/functional/test_check.py index f5e15cba..6be133da 100644 --- a/test/auto/functional/test_check.py +++ b/test/auto/functional/test_check.py @@ -7,6 +7,7 @@ from utils import modify_settings, run_check, run_util from codeplag.consts import CONFIG_PATH, UTIL_NAME, UTIL_VERSION +from codeplag.types import ShortOutput CWD = os.getcwd() CPP_FILES = [ @@ -31,7 +32,8 @@ @pytest.fixture(scope="module", autouse=True) def setup_module(create_reports_folder_module: None): - first_cond = not modify_settings(environment=".env", reports=REPORTS_FOLDER).cmd_res.returncode + modify_settings(reports=REPORTS_FOLDER).assert_success() + first_cond = not modify_settings(environment=".env").cmd_res.returncode second_cond = os.environ.get("ACCESS_TOKEN", "") != "" assert first_cond or second_cond @@ -125,6 +127,22 @@ def test_compare_py_files(cmd: list[str], out: bytes, found_plag: bool): assert out in result.cmd_res.stdout +def test_check_short_output() -> None: + cmd = ["--directories", CPP_DIR] + if len(list(REPORTS_FOLDER.iterdir())): + next(REPORTS_FOLDER.glob("*")).unlink() + modify_settings(short_output=ShortOutput.SHOW_ALL).assert_success() + result = run_check(cmd, extension="cpp") + result.assert_found_similarity() + first_check_stdout_lines = result.cmd_res.stdout.decode("utf-8").split("\n") + + modify_settings(short_output=ShortOutput.SHOW_NEW).assert_success() + result = run_check(cmd, extension="cpp") + result.assert_found_similarity() + assert len(first_check_stdout_lines) != len(result.cmd_res.stdout.decode("utf-8").split("\n")) + modify_settings(short_output=ShortOutput.SHOW_ALL).assert_success() + + @pytest.mark.parametrize( "cmd", [ @@ -139,8 +157,7 @@ def test_check_failed_when_repo_regexp_provided_without_required_args( ): result = run_check(cmd + ["--repo-regexp", "something"]) - result.assert_failed() - assert result.cmd_res.returncode == 2 + result.assert_argparse_error() @pytest.mark.parametrize( @@ -155,5 +172,4 @@ def test_check_failed_when_path_regexp_provided_without_required_args( ): result = run_check(cmd + ["--path-regexp", "something"]) - result.assert_failed() - assert result.cmd_res.returncode == 2 + result.assert_argparse_error() diff --git a/test/auto/functional/test_settings.py b/test/auto/functional/test_settings.py index ddf2dd05..089e5fbc 100644 --- a/test/auto/functional/test_settings.py +++ b/test/auto/functional/test_settings.py @@ -7,7 +7,7 @@ from utils import MaxDepth, NgramsLength, modify_settings from codeplag.consts import CONFIG_PATH, NGRAMS_LENGTH_CHOICE, UTIL_NAME -from codeplag.types import Flag, Language, LogLevel, ReportsExtension, Threshold +from codeplag.types import Flag, Language, LogLevel, ReportsExtension, ShortOutput, Threshold @pytest.fixture(scope="module", autouse=True) @@ -35,7 +35,7 @@ def test_modify_settings( max_depth: MaxDepth, ngrams_length: NgramsLength, show_progress: Flag, - short_output: Flag, + short_output: ShortOutput, reports_extension: ReportsExtension, language: Language, log_level: LogLevel, @@ -73,11 +73,11 @@ def test_modify_settings( @pytest.mark.parametrize( "env,reports,threshold,log_level,short_output", [ - (".env", "src", 101, "debug", 0), - ("setup.py", "test983hskdfue", 67, "info", 0), - (f"src/{UTIL_NAME}/utils.pyjlsieuow0", "debian", 93, "warning", 0), - (f"src/{UTIL_NAME}/types.py", "src", 83, "foobar", 0), - (f"src/{UTIL_NAME}/types.py", "src", 83, "info", 2), + (".env", "src", 101, "debug", ShortOutput.NO_SHOW), + ("setup.py", "test983hskdfue", 67, "info", ShortOutput.NO_SHOW), + (f"src/{UTIL_NAME}/utils.pyjlsieuow0", "debian", 93, "warning", ShortOutput.SHOW_ALL), + (f"src/{UTIL_NAME}/types.py", "src", 83, "foobar", ShortOutput.SHOW_NEW), + (f"src/{UTIL_NAME}/types.py", "src", 83, "info", 3), ], ids=[ "Incorrect threshold.", @@ -93,7 +93,7 @@ def test_modify_settings_with_invalid_arguments( reports: str, threshold: Threshold, log_level: LogLevel, - short_output: Flag, + short_output: ShortOutput, ) -> None: modify_settings( environment=env, diff --git a/test/auto/utils.py b/test/auto/utils.py index da4a849b..dd0b88f2 100644 --- a/test/auto/utils.py +++ b/test/auto/utils.py @@ -1,4 +1,5 @@ import subprocess +from enum import Enum from pathlib import Path from typing import Any, Literal @@ -14,6 +15,7 @@ NgramsLength, ReportsExtension, ReportType, + ShortOutput, Threshold, ) @@ -28,6 +30,9 @@ def assert_success(self: Self) -> None: def assert_failed(self: Self) -> None: assert self.cmd_res.returncode, str(self.cmd_res) + def assert_argparse_error(self: Self) -> None: + assert self.cmd_res.returncode == ExitCode.EXIT_PARSER, str(self.cmd_res) + def assert_found_similarity(self: Self) -> None: assert self.cmd_res.returncode == ExitCode.EXIT_FOUND_SIM, str(self.cmd_res) @@ -50,7 +55,11 @@ def run_check(cmd: list[str], extension: str = "py") -> CmdResult: def create_opt(key: str, value: Any | None) -> list[str]: - return [f"--{key}", str(value)] if value is not None else [] + if value is None: + return [] + if isinstance(value, Enum): + return [f"--{key}", str(value.value)] + return [f"--{key}", str(value)] def create_report( @@ -74,7 +83,7 @@ def modify_settings( max_depth: MaxDepth | None = None, ngrams_length: NgramsLength | None = None, show_progress: Flag | None = None, - short_output: Flag | None = None, + short_output: ShortOutput | None = None, reports_extension: ReportsExtension | None = None, language: Language | None = None, log_level: LogLevel | None = None, diff --git a/test/unit/codeplag/test_config.py b/test/unit/codeplag/test_config.py index 92243eec..0a89d9a4 100644 --- a/test/unit/codeplag/test_config.py +++ b/test/unit/codeplag/test_config.py @@ -139,7 +139,7 @@ def test_read_default_settings_conf(settings_config: Settings | None): "ngrams_length": 5, "environment": "/home/bukabyka/.env", "show_progress": 1, - "short_output": 0, + "short_output": 1, "reports_extension": "json", "language": "ru", "log_level": "error", @@ -151,7 +151,7 @@ def test_read_default_settings_conf(settings_config: Settings | None): "ngrams_length": 5, "environment": Path("/home/bukabyka/.env"), "show_progress": 1, - "short_output": 0, + "short_output": 1, "reports_extension": "json", "language": "ru", "log_level": "error", @@ -159,14 +159,18 @@ def test_read_default_settings_conf(settings_config: Settings | None): }, ], [ - {"bad_field": "bad_field", "reports": "/home/bukabyka/reports"}, + { + "bad_field": "bad_field", + "reports": "/home/bukabyka/reports", + "short_output": 2, + }, { "threshold": DEFAULT_THRESHOLD, "max_depth": DEFAULT_MAX_DEPTH, "ngrams_length": DEFAULT_NGRAMS_LENGTH, "reports": Path("/home/bukabyka/reports"), "show_progress": 0, - "short_output": 0, + "short_output": 2, "reports_extension": DEFAULT_REPORT_EXTENSION, "language": DEFAULT_LANGUAGE, "log_level": DEFAULT_LOG_LEVEL, diff --git a/test/unit/codeplag/test_getfeatures.py b/test/unit/codeplag/test_getfeatures.py index 4e8e130f..340fe279 100644 --- a/test/unit/codeplag/test_getfeatures.py +++ b/test/unit/codeplag/test_getfeatures.py @@ -68,9 +68,30 @@ def test_get_files_path_from_directory( assert files == expected -def test_set_sha256(): - features = ASTFeatures("foo/bar") - features.tokens = [1, 2, 3, 4, 5] - features = set_sha256(lambda: features)() +class TestASTFeatures: + def test_astfeatures_equal(self) -> None: + assert ASTFeatures("foo/bar") == ASTFeatures("foo/bar") - assert features.sha256 == "0c049903ce2330190375d4c1f2e489888c9ebe39daf75b2564e591e8bc1afe72" + def test_astfeatures_different(self) -> None: + assert ASTFeatures("foo/bar") != ASTFeatures("foo/bar2") + + def test_astfeatures_less(self) -> None: + assert ASTFeatures("foo/bar") < ASTFeatures("foo/bbr") + + def test_astfeatures_invalid_compares(self) -> None: + with pytest.raises(NotImplementedError): + assert ASTFeatures("foo/bar") == 1 + with pytest.raises(NotImplementedError): + assert ASTFeatures("foo/bar") < 1 + + def test_set_sha256(self, tmp_path: Path) -> None: + filepath = tmp_path / "foo_bar" + filepath.touch() + features = ASTFeatures(filepath) + features.tokens = [1, 2, 3, 4, 5] + features = set_sha256(lambda: features)() + + assert ( + features.sha256 == "0c049903ce2330190375d4c1f2e489888c9ebe39daf75b2564e591e8bc1afe72" + ) + assert features.modify_date