diff --git a/locales/codeplag.pot b/locales/codeplag.pot index 3860344..58f1681 100644 --- a/locales/codeplag.pot +++ b/locales/codeplag.pot @@ -5,8 +5,8 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: codeplag 0.6.3\n" -"POT-Creation-Date: 2026-07-05 11:17+0300\n" +"Project-Id-Version: codeplag 0.6.5\n" +"POT-Creation-Date: 2026-07-19 18:47+0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Artyom Semidolin\n" "Language-Team: LANGUAGE \n" @@ -57,28 +57,29 @@ msgstr "" msgid "" "If defined, then saves reports about suspect works into provided file or " "directory. If directory by provided path doesn't exists than saves " -"reports as a file." +"reports as a file. Used only when set '--reports_extension' to 'csv'. To " +"reset provide empty string." msgstr "" -#: src/codeplag/codeplagcli.py:136 +#: src/codeplag/codeplagcli.py:137 msgid "" "When provided 'csv' saves similar works compare info into csv file. When " "provided 'mongo' saves similar works compare info and works metadata into" " MongoDB." msgstr "" -#: src/codeplag/codeplagcli.py:146 +#: src/codeplag/codeplagcli.py:147 msgid "Show progress of searching plagiarism." msgstr "" -#: src/codeplag/codeplagcli.py:154 +#: src/codeplag/codeplagcli.py:155 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:165 +#: src/codeplag/codeplagcli.py:166 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. " @@ -86,172 +87,172 @@ msgid "" "minimal similarity will be found." msgstr "" -#: src/codeplag/codeplagcli.py:178 +#: src/codeplag/codeplagcli.py:179 msgid "The maximum depth of the AST structure which play role in calculations." msgstr "" -#: src/codeplag/codeplagcli.py:186 +#: src/codeplag/codeplagcli.py:187 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:196 +#: src/codeplag/codeplagcli.py:197 msgid "The language of help messages, generated reports, errors." msgstr "" -#: src/codeplag/codeplagcli.py:203 +#: src/codeplag/codeplagcli.py:204 #, python-brace-format 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:212 +#: src/codeplag/codeplagcli.py:213 msgid "The maximum number of processes that can be used to compare works." msgstr "" -#: src/codeplag/codeplagcli.py:219 +#: src/codeplag/codeplagcli.py:220 msgid "The host address of the MongoDB server." msgstr "" -#: src/codeplag/codeplagcli.py:225 +#: src/codeplag/codeplagcli.py:226 msgid "The port of the MongoDB." msgstr "" -#: src/codeplag/codeplagcli.py:233 +#: src/codeplag/codeplagcli.py:234 msgid "The username for connecting to the MongoDB server." msgstr "" -#: src/codeplag/codeplagcli.py:239 +#: src/codeplag/codeplagcli.py:240 msgid "The password for connecting to the MongoDB server. If empty - hide input." msgstr "" -#: src/codeplag/codeplagcli.py:248 +#: src/codeplag/codeplagcli.py:249 #, python-brace-format msgid "Show the '{util_name}' util settings." msgstr "" -#: src/codeplag/codeplagcli.py:252 +#: src/codeplag/codeplagcli.py:253 msgid "Start searching similar works." msgstr "" -#: src/codeplag/codeplagcli.py:258 +#: src/codeplag/codeplagcli.py:259 msgid "Absolute or relative path to a local directories with project files." msgstr "" -#: src/codeplag/codeplagcli.py:268 +#: src/codeplag/codeplagcli.py:269 msgid "Absolute or relative path to files on a computer." msgstr "" -#: src/codeplag/codeplagcli.py:276 +#: src/codeplag/codeplagcli.py:277 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:287 +#: src/codeplag/codeplagcli.py:288 msgid "" "A regular expression for filtering checked works by name. Used with " "options 'directories', 'github-user' and 'github-urls'." msgstr "" -#: src/codeplag/codeplagcli.py:295 +#: src/codeplag/codeplagcli.py:296 msgid "Ignore the threshold when checking of works." msgstr "" -#: src/codeplag/codeplagcli.py:302 +#: src/codeplag/codeplagcli.py:303 msgid "Extension responsible for the analyzed programming language." msgstr "" -#: src/codeplag/codeplagcli.py:312 +#: src/codeplag/codeplagcli.py:313 msgid "Searching in all branches." msgstr "" -#: src/codeplag/codeplagcli.py:319 +#: src/codeplag/codeplagcli.py:320 msgid "A regular expression to filter searching repositories on GitHub." msgstr "" -#: src/codeplag/codeplagcli.py:322 +#: src/codeplag/codeplagcli.py:323 msgid "GitHub organization/user name." msgstr "" -#: src/codeplag/codeplagcli.py:329 +#: src/codeplag/codeplagcli.py:330 msgid "URL to a GitHub file or folder." msgstr "" -#: src/codeplag/codeplagcli.py:340 +#: src/codeplag/codeplagcli.py:341 #, python-brace-format msgid "" "Handling generated by the {util_name} reports as creating html report " "file or show it on console." msgstr "" -#: src/codeplag/codeplagcli.py:347 +#: src/codeplag/codeplagcli.py:348 #, python-brace-format msgid "Report commands of the '{util_name}' util." msgstr "" -#: src/codeplag/codeplagcli.py:356 +#: src/codeplag/codeplagcli.py:357 msgid "Generate general report from created some time ago report files." msgstr "" -#: src/codeplag/codeplagcli.py:362 +#: src/codeplag/codeplagcli.py:363 msgid "" "Path to save generated report. If it's a directory, then create a file in" " it." msgstr "" -#: src/codeplag/codeplagcli.py:370 +#: src/codeplag/codeplagcli.py:371 msgid "Type of the created report file." msgstr "" -#: src/codeplag/codeplagcli.py:379 +#: src/codeplag/codeplagcli.py:380 msgid "" "Path to first compared works. Can be path to directory or URL to the " "project folder." msgstr "" -#: src/codeplag/codeplagcli.py:389 +#: src/codeplag/codeplagcli.py:390 msgid "" "Path to second compared works. Can be path to directory or URL to the " "project folder." msgstr "" -#: src/codeplag/codeplagcli.py:401 +#: src/codeplag/codeplagcli.py:402 msgid "" "Program help to find similar parts of source codes for the different " "languages." msgstr "" -#: src/codeplag/codeplagcli.py:407 +#: src/codeplag/codeplagcli.py:408 msgid "Print current version number and exit." msgstr "" -#: src/codeplag/codeplagcli.py:413 +#: src/codeplag/codeplagcli.py:414 msgid "Commands help." msgstr "" -#: src/codeplag/codeplagcli.py:428 +#: src/codeplag/codeplagcli.py:429 msgid "No command is provided; please choose one from the available (--help)." msgstr "" -#: src/codeplag/codeplagcli.py:439 +#: src/codeplag/codeplagcli.py:440 msgid "There is nothing to modify; please provide at least one argument." msgstr "" -#: src/codeplag/codeplagcli.py:443 +#: src/codeplag/codeplagcli.py:444 msgid "The 'repo-regexp' option requires the provided 'github-user' option." msgstr "" -#: src/codeplag/codeplagcli.py:450 +#: src/codeplag/codeplagcli.py:451 msgid "" "The 'path-regexp' option requires the provided 'directories', 'github-" "user', or 'github-urls' options." msgstr "" -#: src/codeplag/codeplagcli.py:460 src/codeplag/handlers/report.py:441 +#: src/codeplag/codeplagcli.py:461 src/codeplag/handlers/report.py:441 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 c023c19..cbfb48c 100644 --- a/locales/translations/en/LC_MESSAGES/codeplag.po +++ b/locales/translations/en/LC_MESSAGES/codeplag.po @@ -58,13 +58,15 @@ msgstr "Path to the environment file with GitHub access token." msgid "" "If defined, then saves reports about suspect works into provided file or " "directory. If directory by provided path doesn't exists than saves " -"reports as a file." +"reports as a file. Used only when set '--reports_extension' to 'csv'. To " +"reset provide empty string." msgstr "" "If defined, then saves reports about suspect works into provided file or " "directory. If directory by provided path doesn't exists than saves " -"reports as a file." +"reports as a file. Used only when set '--reports_extension' to 'csv'. To " +"reset provide empty string." -#: src/codeplag/codeplagcli.py:136 +#: src/codeplag/codeplagcli.py:137 msgid "" "When provided 'csv' saves similar works compare info into csv file. When " "provided 'mongo' saves similar works compare info and works metadata into" @@ -74,11 +76,11 @@ msgstr "" "provided 'mongo' saves similar works compare info and works metadata into" " MongoDB." -#: src/codeplag/codeplagcli.py:146 +#: src/codeplag/codeplagcli.py:147 msgid "Show progress of searching plagiarism." msgstr "Show progress of searching plagiarism." -#: src/codeplag/codeplagcli.py:154 +#: src/codeplag/codeplagcli.py:155 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 " @@ -88,7 +90,7 @@ msgstr "" "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:165 +#: src/codeplag/codeplagcli.py:166 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. " @@ -100,11 +102,11 @@ msgstr "" "Otherwise, if this number is small, such as 50, then all work with " "minimal similarity will be found." -#: src/codeplag/codeplagcli.py:178 +#: src/codeplag/codeplagcli.py:179 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:186 +#: src/codeplag/codeplagcli.py:187 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 " @@ -114,11 +116,11 @@ msgstr "" "long length of N-grams reduces the Jakkar coefficient because there are " "fewer equal sequences of two works." -#: src/codeplag/codeplagcli.py:196 +#: src/codeplag/codeplagcli.py:197 msgid "The language of help messages, generated reports, errors." msgstr "The language of help messages, generated reports, errors." -#: src/codeplag/codeplagcli.py:203 +#: src/codeplag/codeplagcli.py:204 #, python-brace-format msgid "" "Sets the threshold for the '{util_name}' util loggers'. Logging messages " @@ -127,44 +129,44 @@ 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:212 +#: src/codeplag/codeplagcli.py:213 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:219 +#: src/codeplag/codeplagcli.py:220 msgid "The host address of the MongoDB server." msgstr "The host address of the MongoDB server." -#: src/codeplag/codeplagcli.py:225 +#: src/codeplag/codeplagcli.py:226 msgid "The port of the MongoDB." msgstr "The port of the MongoDB." -#: src/codeplag/codeplagcli.py:233 +#: src/codeplag/codeplagcli.py:234 msgid "The username for connecting to the MongoDB server." msgstr "The username for connecting to the MongoDB server." -#: src/codeplag/codeplagcli.py:239 +#: src/codeplag/codeplagcli.py:240 msgid "The password for connecting to the MongoDB server. If empty - hide input." msgstr "The password for connecting to the MongoDB server. If empty - hide input." -#: src/codeplag/codeplagcli.py:248 +#: src/codeplag/codeplagcli.py:249 #, python-brace-format msgid "Show the '{util_name}' util settings." msgstr "Show the '{util_name}' util settings." -#: src/codeplag/codeplagcli.py:252 +#: src/codeplag/codeplagcli.py:253 msgid "Start searching similar works." msgstr "Start searching similar works." -#: src/codeplag/codeplagcli.py:258 +#: src/codeplag/codeplagcli.py:259 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:268 +#: src/codeplag/codeplagcli.py:269 msgid "Absolute or relative path to files on a computer." msgstr "Absolute or relative path to files on a computer." -#: src/codeplag/codeplagcli.py:276 +#: src/codeplag/codeplagcli.py:277 msgid "" "Choose one of the following modes of searching plagiarism. The " "'many_to_many' mode may require more free memory." @@ -172,7 +174,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:287 +#: src/codeplag/codeplagcli.py:288 msgid "" "A regular expression for filtering checked works by name. Used with " "options 'directories', 'github-user' and 'github-urls'." @@ -180,31 +182,31 @@ msgstr "" "A regular expression for filtering checked works by name. Used with " "options 'directories', 'github-user' and 'github-urls'." -#: src/codeplag/codeplagcli.py:295 +#: src/codeplag/codeplagcli.py:296 msgid "Ignore the threshold when checking of works." msgstr "Ignore the threshold when checking of works." -#: src/codeplag/codeplagcli.py:302 +#: src/codeplag/codeplagcli.py:303 msgid "Extension responsible for the analyzed programming language." msgstr "Extension responsible for the analyzed programming language." -#: src/codeplag/codeplagcli.py:312 +#: src/codeplag/codeplagcli.py:313 msgid "Searching in all branches." msgstr "Searching in all branches." -#: src/codeplag/codeplagcli.py:319 +#: src/codeplag/codeplagcli.py:320 msgid "A regular expression to filter searching repositories on GitHub." msgstr "A regular expression to filter searching repositories on GitHub." -#: src/codeplag/codeplagcli.py:322 +#: src/codeplag/codeplagcli.py:323 msgid "GitHub organization/user name." msgstr "GitHub organization/user name." -#: src/codeplag/codeplagcli.py:329 +#: src/codeplag/codeplagcli.py:330 msgid "URL to a GitHub file or folder." msgstr "URL to a GitHub file or folder." -#: src/codeplag/codeplagcli.py:340 +#: src/codeplag/codeplagcli.py:341 #, python-brace-format msgid "" "Handling generated by the {util_name} reports as creating html report " @@ -213,16 +215,16 @@ msgstr "" "Handling generated by the {util_name} reports as creating html report " "file or show it on console." -#: src/codeplag/codeplagcli.py:347 +#: src/codeplag/codeplagcli.py:348 #, python-brace-format msgid "Report commands of the '{util_name}' util." msgstr "Report commands of the '{util_name}' util." -#: src/codeplag/codeplagcli.py:356 +#: src/codeplag/codeplagcli.py:357 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:362 +#: src/codeplag/codeplagcli.py:363 msgid "" "Path to save generated report. If it's a directory, then create a file in" " it." @@ -230,11 +232,11 @@ msgstr "" "Path to save generated report. If it's a directory, then create a file in" " it." -#: src/codeplag/codeplagcli.py:370 +#: src/codeplag/codeplagcli.py:371 msgid "Type of the created report file." msgstr "Type of the created report file." -#: src/codeplag/codeplagcli.py:379 +#: src/codeplag/codeplagcli.py:380 msgid "" "Path to first compared works. Can be path to directory or URL to the " "project folder." @@ -242,7 +244,7 @@ msgstr "" "Path to first compared works. Can be path to directory or URL to the " "project folder." -#: src/codeplag/codeplagcli.py:389 +#: src/codeplag/codeplagcli.py:390 msgid "" "Path to second compared works. Can be path to directory or URL to the " "project folder." @@ -250,7 +252,7 @@ msgstr "" "Path to second compared works. Can be path to directory or URL to the " "project folder." -#: src/codeplag/codeplagcli.py:401 +#: src/codeplag/codeplagcli.py:402 msgid "" "Program help to find similar parts of source codes for the different " "languages." @@ -258,27 +260,27 @@ msgstr "" "Program help to find similar parts of source codes for the different " "languages." -#: src/codeplag/codeplagcli.py:407 +#: src/codeplag/codeplagcli.py:408 msgid "Print current version number and exit." msgstr "Print current version number and exit." -#: src/codeplag/codeplagcli.py:413 +#: src/codeplag/codeplagcli.py:414 msgid "Commands help." msgstr "Commands help." -#: src/codeplag/codeplagcli.py:428 +#: src/codeplag/codeplagcli.py:429 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:439 +#: src/codeplag/codeplagcli.py:440 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:443 +#: src/codeplag/codeplagcli.py:444 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:450 +#: src/codeplag/codeplagcli.py:451 msgid "" "The 'path-regexp' option requires the provided 'directories', 'github-" "user', or 'github-urls' options." @@ -286,7 +288,7 @@ msgstr "" "The'path-regexp' option requires the provided 'directories', 'github-" "user', or 'github-urls' options." -#: src/codeplag/codeplagcli.py:460 src/codeplag/handlers/report.py:441 +#: src/codeplag/codeplagcli.py:461 src/codeplag/handlers/report.py:441 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 2089395..3dd5220 100644 --- a/locales/translations/ru/LC_MESSAGES/codeplag.po +++ b/locales/translations/ru/LC_MESSAGES/codeplag.po @@ -61,13 +61,15 @@ msgstr "Путь к файлу окружения с токеном доступ msgid "" "If defined, then saves reports about suspect works into provided file or " "directory. If directory by provided path doesn't exists than saves " -"reports as a file." +"reports as a file. Used only when set '--reports_extension' to 'csv'. To " +"reset provide empty string." msgstr "" "Если значение определено, то сохраняет отчеты о подозрительных работах в " "указанный файл или папку. Если каталог по указанному пути не существует, " -"то сохраняет отчеты в файл." +"то сохраняет отчеты в файл. Используется только при установке для '--reports_extension' значения 'csv'. " +"Для сброса укажите пустую строку." -#: src/codeplag/codeplagcli.py:136 +#: src/codeplag/codeplagcli.py:137 msgid "" "When provided 'csv' saves similar works compare info into csv file. When " "provided 'mongo' saves similar works compare info and works metadata into" @@ -77,11 +79,11 @@ msgstr "" " csv файл. При заданном значении 'mongo' сохраняет результаты сравнения " "схожих работ и метаданные работ в MongoDB." -#: src/codeplag/codeplagcli.py:146 +#: src/codeplag/codeplagcli.py:147 msgid "Show progress of searching plagiarism." msgstr "Показывать прогресс выполнения поиска схожих работ." -#: src/codeplag/codeplagcli.py:154 +#: src/codeplag/codeplagcli.py:155 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 " @@ -92,7 +94,7 @@ msgstr "" "результаты проверок. При заданном значении '2' не показывать результаты " "проверок в stdout." -#: src/codeplag/codeplagcli.py:165 +#: src/codeplag/codeplagcli.py:166 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. " @@ -105,11 +107,11 @@ msgstr "" "будет невелико, например, 50, то будут найдены все работы с минимальным " "сходством." -#: src/codeplag/codeplagcli.py:178 +#: src/codeplag/codeplagcli.py:179 msgid "The maximum depth of the AST structure which play role in calculations." msgstr "Максимальная глубина структуры AST, учитываемая при структурном сравнении." -#: src/codeplag/codeplagcli.py:186 +#: src/codeplag/codeplagcli.py:187 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 " @@ -119,11 +121,11 @@ msgstr "" "Большая длина N-грамм уменьшает коэффициент Жаккара, поскольку количество" " одинаковых последовательностей из двух работ становится меньше." -#: src/codeplag/codeplagcli.py:196 +#: src/codeplag/codeplagcli.py:197 msgid "The language of help messages, generated reports, errors." msgstr "Язык справочных сообщений, сгенерированных отчетов, ошибок." -#: src/codeplag/codeplagcli.py:203 +#: src/codeplag/codeplagcli.py:204 #, python-brace-format msgid "" "Sets the threshold for the '{util_name}' util loggers'. Logging messages " @@ -133,46 +135,46 @@ msgstr "" "Сообщения, которые менее серьезны, чем это значение, будут " "игнорироваться." -#: src/codeplag/codeplagcli.py:212 +#: src/codeplag/codeplagcli.py:213 msgid "The maximum number of processes that can be used to compare works." msgstr "" "Максимальное количество процессов, которые можно задействовать для " "сравнения работ." -#: src/codeplag/codeplagcli.py:219 +#: src/codeplag/codeplagcli.py:220 msgid "The host address of the MongoDB server." msgstr "Адрес хоста сервера MongoDB." -#: src/codeplag/codeplagcli.py:225 +#: src/codeplag/codeplagcli.py:226 msgid "The port of the MongoDB." msgstr "Порт MongoDB." -#: src/codeplag/codeplagcli.py:233 +#: src/codeplag/codeplagcli.py:234 msgid "The username for connecting to the MongoDB server." msgstr "Имя пользователя для подключения к серверу MongoDB." -#: src/codeplag/codeplagcli.py:239 +#: src/codeplag/codeplagcli.py:240 msgid "The password for connecting to the MongoDB server. If empty - hide input." msgstr "Пароль для подключения к серверу MongoDB. Если пуст - скрытый ввод." -#: src/codeplag/codeplagcli.py:248 +#: src/codeplag/codeplagcli.py:249 #, python-brace-format msgid "Show the '{util_name}' util settings." msgstr "Показать настройки утилиты '{util_name}'." -#: src/codeplag/codeplagcli.py:252 +#: src/codeplag/codeplagcli.py:253 msgid "Start searching similar works." msgstr "Начать поиск схожих работ." -#: src/codeplag/codeplagcli.py:258 +#: src/codeplag/codeplagcli.py:259 msgid "Absolute or relative path to a local directories with project files." msgstr "Абсолютный или относительный путь к локальным папкам с файлами проекта." -#: src/codeplag/codeplagcli.py:268 +#: src/codeplag/codeplagcli.py:269 msgid "Absolute or relative path to files on a computer." msgstr "Абсолютный или относительный путь к файлам на компьютере." -#: src/codeplag/codeplagcli.py:276 +#: src/codeplag/codeplagcli.py:277 msgid "" "Choose one of the following modes of searching plagiarism. The " "'many_to_many' mode may require more free memory." @@ -180,7 +182,7 @@ msgstr "" "Выберите один из следующих режимов поиска схожих работ. Режим " "'many_to_many' может требовать больше свободной памяти." -#: src/codeplag/codeplagcli.py:287 +#: src/codeplag/codeplagcli.py:288 msgid "" "A regular expression for filtering checked works by name. Used with " "options 'directories', 'github-user' and 'github-urls'." @@ -189,31 +191,31 @@ msgstr "" "Используется с аргументами 'directories', 'github-user' или 'github-" "project-folders'." -#: src/codeplag/codeplagcli.py:295 +#: src/codeplag/codeplagcli.py:296 msgid "Ignore the threshold when checking of works." msgstr "Игнорировать пороговое значение при проверке работ." -#: src/codeplag/codeplagcli.py:302 +#: src/codeplag/codeplagcli.py:303 msgid "Extension responsible for the analyzed programming language." msgstr "Расширение проверяемых работ." -#: src/codeplag/codeplagcli.py:312 +#: src/codeplag/codeplagcli.py:313 msgid "Searching in all branches." msgstr "Поиск по всем веткам." -#: src/codeplag/codeplagcli.py:319 +#: src/codeplag/codeplagcli.py:320 msgid "A regular expression to filter searching repositories on GitHub." msgstr "Регулярное выражение для фильтрации искомых репозиториев на GitHub." -#: src/codeplag/codeplagcli.py:322 +#: src/codeplag/codeplagcli.py:323 msgid "GitHub organization/user name." msgstr "Название организации или имя пользователя на GitHub." -#: src/codeplag/codeplagcli.py:329 +#: src/codeplag/codeplagcli.py:330 msgid "URL to a GitHub file or folder." msgstr "URL до какой-либо папки или файла проекта на GitHub." -#: src/codeplag/codeplagcli.py:340 +#: src/codeplag/codeplagcli.py:341 #, python-brace-format msgid "" "Handling generated by the {util_name} reports as creating html report " @@ -222,16 +224,16 @@ msgstr "" "Обработка отчетов, сгенерированных с помощью {util_name}, в виде создания" " файла отчета в формате html или отображения его на консоли." -#: src/codeplag/codeplagcli.py:347 +#: src/codeplag/codeplagcli.py:348 #, python-brace-format msgid "Report commands of the '{util_name}' util." msgstr "Команды для работы с отчётами утилиты '{util_name}'." -#: src/codeplag/codeplagcli.py:356 +#: src/codeplag/codeplagcli.py:357 msgid "Generate general report from created some time ago report files." msgstr "Создание общего отчёта из созданных ранее файлов отчётов." -#: src/codeplag/codeplagcli.py:362 +#: src/codeplag/codeplagcli.py:363 msgid "" "Path to save generated report. If it's a directory, then create a file in" " it." @@ -239,11 +241,11 @@ msgstr "" "Путь для сохранения созданного отчёта. Если передан путь до папки, то " "создаёт отчёт в ней." -#: src/codeplag/codeplagcli.py:370 +#: src/codeplag/codeplagcli.py:371 msgid "Type of the created report file." msgstr "Тип создаваемого файла отчёта." -#: src/codeplag/codeplagcli.py:379 +#: src/codeplag/codeplagcli.py:380 msgid "" "Path to first compared works. Can be path to directory or URL to the " "project folder." @@ -251,7 +253,7 @@ msgstr "" "Путь к первым сравниваемым файлам. Это может быть путь к директории или " "URL к папке проекта." -#: src/codeplag/codeplagcli.py:389 +#: src/codeplag/codeplagcli.py:390 msgid "" "Path to second compared works. Can be path to directory or URL to the " "project folder." @@ -259,7 +261,7 @@ msgstr "" "Путь ко вторым сравниваемым файлам. Это может быть путь к директории или " "URL к папке проекта." -#: src/codeplag/codeplagcli.py:401 +#: src/codeplag/codeplagcli.py:402 msgid "" "Program help to find similar parts of source codes for the different " "languages." @@ -267,31 +269,31 @@ msgstr "" "Программа помогает находить схожие части исходных кодов для разных языков" " программирования." -#: src/codeplag/codeplagcli.py:407 +#: src/codeplag/codeplagcli.py:408 msgid "Print current version number and exit." msgstr "Выводит текущую версию программы." -#: src/codeplag/codeplagcli.py:413 +#: src/codeplag/codeplagcli.py:414 msgid "Commands help." msgstr "Справка по командам." -#: src/codeplag/codeplagcli.py:428 +#: src/codeplag/codeplagcli.py:429 msgid "No command is provided; please choose one from the available (--help)." msgstr "" "Ни одна из команд не выбрана, пожалуйста, выбери одну из доступных команд" " (--help)." -#: src/codeplag/codeplagcli.py:439 +#: src/codeplag/codeplagcli.py:440 msgid "There is nothing to modify; please provide at least one argument." msgstr "" "Нечего модифицировать, пожалуйста, выберите один из параметров для " "модификации." -#: src/codeplag/codeplagcli.py:443 +#: src/codeplag/codeplagcli.py:444 msgid "The 'repo-regexp' option requires the provided 'github-user' option." msgstr "Аргумент 'repo-regexp' требует заданного параметра 'github-user'." -#: src/codeplag/codeplagcli.py:450 +#: src/codeplag/codeplagcli.py:451 msgid "" "The 'path-regexp' option requires the provided 'directories', 'github-" "user', or 'github-urls' options." @@ -299,7 +301,7 @@ msgstr "" "Аргумент 'path-regexp' требует заданного параметра 'directories', " "'github-user' или 'github-urls'." -#: src/codeplag/codeplagcli.py:460 src/codeplag/handlers/report.py:441 +#: src/codeplag/codeplagcli.py:461 src/codeplag/handlers/report.py:441 msgid "All paths must be provided." msgstr "Необходимо указать все корневые пути или не указывать ни одного." diff --git a/pyproject.toml b/pyproject.toml index a5e51ab..0621583 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "codeplag" -version = "0.6.4" +version = "0.6.5" description = "Code plagiarism searching package." authors = [ { name = "Artyom Semidolin, Dmitry Nikolaev, Alexander Evsikov" } diff --git a/src/codeplag/codeplagcli.py b/src/codeplag/codeplagcli.py index 3b0d7a5..0859569 100644 --- a/src/codeplag/codeplagcli.py +++ b/src/codeplag/codeplagcli.py @@ -124,10 +124,11 @@ def __add_settings_path(self: Self, subparsers: argparse._SubParsersAction) -> N help=_( "If defined, then saves reports about suspect works into provided file or " "directory. If directory by provided path doesn't exists than saves reports " - "as a file." + "as a file. Used only when set '--reports_extension' to 'csv'. " + "To reset provide empty string." ), metavar="PATH", - type=Path, + type=str, ) settings_modify.add_argument( "-re", diff --git a/src/codeplag/handlers/settings.py b/src/codeplag/handlers/settings.py index fa38c8e..396574b 100644 --- a/src/codeplag/handlers/settings.py +++ b/src/codeplag/handlers/settings.py @@ -5,6 +5,7 @@ import pandas as pd from codeplag.config import read_settings_conf, write_settings_conf +from codeplag.logger import codeplag_logger as logger from codeplag.types import Settings @@ -21,14 +22,26 @@ def settings_show() -> None: def settings_modify(parsed_args: dict[str, Any]) -> None: + if not parsed_args: + logger.info("No arguments provided to change settings.") + return + settings_config = read_settings_conf() + + # Because in the argument parser 'reports' parsed as a string + if parsed_args.get("reports"): + parsed_args["reports"] = Path(parsed_args["reports"]) + for key in Settings.__annotations__: new_value = parsed_args.get(key) if new_value is None: continue + if new_value == "" and key in settings_config: + logger.info("Empty value provided for setting '%s', deleting it.", key) + del settings_config[key] + continue if isinstance(new_value, Path): settings_config[key] = new_value.resolve() else: settings_config[key] = new_value - - write_settings_conf(settings_config) + write_settings_conf(settings_config) diff --git a/test/auto/functional/test_settings.py b/test/auto/functional/test_settings.py index d729f6b..6a8e84e 100644 --- a/test/auto/functional/test_settings.py +++ b/test/auto/functional/test_settings.py @@ -4,7 +4,7 @@ import pytest from typing_extensions import Self -from utils import MaxDepth, NgramsLength, modify_settings +from utils import MaxDepth, NgramsLength, modify_settings, show_settings from codeplag.consts import CONFIG_PATH, NGRAMS_LENGTH_CHOICE, UTIL_NAME from codeplag.types import Flag, Language, LogLevel, ReportsExtension, ShortOutput, Threshold @@ -202,3 +202,10 @@ def test_modify_settings_with_invalid_mongo_port(self: Self, mongo_port: int) -> def test_modify_settings_with_no_arguments_failed(self: Self) -> None: modify_settings().assert_failed() + + def test_reset_reports_path(self: Self) -> None: + modify_settings(reports="reports").assert_success() + assert b"reports " in show_settings().cmd_res.stdout + + modify_settings(reports="").assert_success() + assert b"reports " not in show_settings().cmd_res.stdout diff --git a/test/unit/codeplag/handlers/test_settings.py b/test/unit/codeplag/handlers/test_settings.py new file mode 100644 index 0000000..a5377d4 --- /dev/null +++ b/test/unit/codeplag/handlers/test_settings.py @@ -0,0 +1,109 @@ +from __future__ import annotations + +from pathlib import Path +from unittest.mock import MagicMock + +import pytest +from pytest_mock import MockerFixture + +from codeplag.handlers.settings import settings_modify + + +@pytest.fixture +def mock_read_settings_conf(mocker: MockerFixture) -> MagicMock: + return mocker.patch("codeplag.handlers.settings.read_settings_conf") + + +@pytest.fixture +def mock_write_settings_conf(mocker: MockerFixture) -> MagicMock: + return mocker.patch("codeplag.handlers.settings.write_settings_conf") + + +class TestSettingsModify: + def test_settings_modify_with_none_args( + self, mock_read_settings_conf: MagicMock, mock_write_settings_conf: MagicMock + ) -> None: + mock_read_settings_conf.return_value = { + "threshold": 75, + "max_depth": 5, + } + + settings_modify({}) + + mock_read_settings_conf.assert_not_called() + mock_write_settings_conf.assert_not_called() + + def test_settings_modify_updates_single_field( + self, mock_read_settings_conf: MagicMock, mock_write_settings_conf: MagicMock + ) -> None: + mock_read_settings_conf.return_value = { + "threshold": 75, + "max_depth": 5, + } + + settings_modify({"threshold": 90}) + + mock_read_settings_conf.assert_called_once_with() + mock_write_settings_conf.assert_called_once_with( + { + "threshold": 90, + "max_depth": 5, + } + ) + + def test_settings_modify_updates_multiple_fields( + self, mock_read_settings_conf: MagicMock, mock_write_settings_conf: MagicMock + ) -> None: + mock_read_settings_conf.return_value = { + "threshold": 75, + "max_depth": 5, + "ngrams_length": 3, + } + + settings_modify({"threshold": 90, "max_depth": 7, "ngrams_length": 5}) + + mock_read_settings_conf.assert_called_once_with() + mock_write_settings_conf.assert_called_once_with( + { + "threshold": 90, + "max_depth": 7, + "ngrams_length": 5, + } + ) + + def test_settings_modify_deletes_field_with_empty_string( + self, mock_read_settings_conf: MagicMock, mock_write_settings_conf: MagicMock + ) -> None: + mock_read_settings_conf.return_value = { + "threshold": 75, + "max_depth": 5, + "reports": Path("reports"), + } + + settings_modify({"reports": ""}) + + mock_read_settings_conf.assert_called_once_with() + mock_write_settings_conf.assert_called_once_with( + { + "threshold": 75, + "max_depth": 5, + } + ) + + def test_settings_modify_ignores_unknown_fields( + self, mock_read_settings_conf: MagicMock, mock_write_settings_conf: MagicMock + ) -> None: + mock_read_settings_conf.return_value = { + "threshold": 75, + "max_depth": 5, + } + + settings_modify({"unknown_field": "value"}) + + mock_read_settings_conf.assert_called_once_with() + mock_write_settings_conf.assert_called_once_with( + { + "threshold": 75, + "max_depth": 5, + } + )