From 08b22b640099bd6b62263dcdedae6cd8fc397880 Mon Sep 17 00:00:00 2001 From: Nikkel Mollenhauer <57323886+NikkelM@users.noreply.github.com> Date: Thu, 29 Feb 2024 00:40:16 +0100 Subject: [PATCH] Fixed the default value of the `additional_lines` option (#58) --- .github/config.yml | 8 ++++---- CHANGELOG.md | 8 ++++++-- README.md | 2 +- app.rb | 2 +- version.rb | 2 +- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/config.yml b/.github/config.yml index 04706a7..163d74e 100644 --- a/.github/config.yml +++ b/.github/config.yml @@ -1,7 +1,7 @@ todo-pr-checker: # When should comments be posted? post_comment: 'items_found' - # Files that get matched by any of these regular expressions will be ignored + # Files that get matched by any of these glob patterns will be ignored ignore_files: null # What action items should be looked for (setting this will the overwrite default values) action_items: ['TODO', 'FIXME', 'BUG'] @@ -14,14 +14,14 @@ todo-pr-checker: ['php', ['//', '#'], '/*', '*/'], ['.py', '#'] ] + # How many lines below found action items should be shown in the embedded code snippet + # If there are no more lines below the action item before the file ends, the code snippet will not be able to render + additional_lines: 1 # Whether or not searching for action items should be case sensitive case_sensitive: false # If multiline comments should also be searched for action items # This may result in some false positives or negatives if the opening or closing lines of a comment are not in the diff multiline_comments: false - # How many lines below found action items should be shown in the embedded code snippet - # If there are no more lines below the action item before the file ends, the code snippet will not be able to render - additional_lines: 1 # Whether or not each action item should always be rendered in a separate code snippet # If disabled, action items that are located close to each other will be rendered in the same code snippet always_split_snippets: false diff --git a/CHANGELOG.md b/CHANGELOG.md index 13bbf8a..7fadfdc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,18 @@ # Changelog -## v1.4.0 +## v1.4.1 +- Fixed the default value of the `additional_lines` configuration option not being set to 1. + + +## v1.4.0 + - Added a new `additional_lines` configuration option to control how many lines below action items are rendered in code snippets. - Added a new `always_split_snippets` configuration option to control whether or not action items should always be rendered in seperate code snippets, even when they are located close to each other in code. - The app now supports multiple line comment types for languages that have them, such as `//` and `#` for PHP. - The check run initiated by the app will now be marked as skipped if no checkable changed files are found in the Pull Request. - The check run summary will now include a list of skipped files. - ## v1.3.2 diff --git a/README.md b/README.md index 1372a63..de7eff0 100644 --- a/README.md +++ b/README.md @@ -55,9 +55,9 @@ To get started, you can copy the `.github/config.yml` file from this repository | `ignore_files` | `string[]`, maximum 7 entries | A list of glob patterns to specify files that should be ignored during the check. You may specify up to 7 patterns. The pattern matching logic used is the same as for `.gitignore` files. | `null` | | `action_items` | `string[]`, maximum 15 entries | A list of action items to look for in code comments. If you set this option, the default values will be overwritten, so you must include them in your list to use them. By default, action items are case insensitive. You may specify up to 15 items. | `['TODO', 'FIXME', 'BUG']` | | `add_languages` | `[string[file_type, line_start, block_start, block_end]]`
Example: `[['js', '//', '/*', '*,'], ['php', ['//', '#'], '/*', '*/'], ['css', null, '/*', '*/'], ['.py', '#']]`, maximum 10 entries | A list of a list of programming languages to add support for. This list will be added to the already supported languages. If you define a language that is already supported, the default values will be overwritten. `file_type` must be the extension of the file (e.g. `js`) and may start with a `.`. If the file type you are adding supports mulitple line comment types, you may define an `array` of `strings` instead of just a `string`. You may omit the block comment definitions if the file type does not support block comments. If you want to omit the definition of a line comment, you may set `line_start` to `null` or omit it. If defining `block_start`, `block_end` must also be defined. You may specify up to 10 new file types. *The file types shown in the example are already natively supported by the app.* | `null` | +| `additional_lines` | `integer` between `0` and `10` | The number of additional lines to include below found action items in embedded code snippets. If set to `0`, the code snippet shows only the line with the action item. This setting does not influence the behaviour of showing multiple action items in one snippet if they are located close to each other. *Note that if there are not enough lines left in the file to display, the embedded code snippet will not be able to render at all and will display as a link only.* | `1` | | `case_sensitive` | `true`, `false` | Controls whether the app should look for action items in a case-sensitive manner. | `false` | | `multiline_comments` | `true`, `false` | Whether or not looking for action items in multiline block comments is enabled or not. When enabled, the app *may* incorrectly mark action items in your Pull Request if at least one of the opening or closing line of the block comment (e.g. `*/` and `/*` in JavaScript) are not included in the Pull Request diff, which causes them to not be found by the app. For multiline comments to always work, you must ensure that both the opening and closing characters are included in the diff. Action items located on the first line of a block comment will always be detected, even if this option is disabled. | `false` | -| `additional_lines` | `integer` between `0` and `10` | The number of additional lines to include below found action items in embedded code snippets. If set to `0`, the code snippet shows only the line with the action item. This setting does not influence the behaviour of showing multiple action items in one snippet if they are located close to each other. *Note that if there are not enough lines left in the file to display, the embedded code snippet will not be able to render at all and will display as a link only.* | `1` | | `always_split_snippets` | `true`, `false` | Whether or not action items should always be rendered in separate code snippets, even when they are located close to each other in code. | `false` |
diff --git a/app.rb b/app.rb index a8bfaaf..cc3f68f 100644 --- a/app.rb +++ b/app.rb @@ -188,7 +188,7 @@ def get_app_options(full_repo_name, head_sha) 'case_sensitive' => false, 'add_languages' => [], 'ignore_files' => [], - 'additional_lines' => 0, + 'additional_lines' => 1, 'always_split_snippets' => false } diff --git a/version.rb b/version.rb index 275a43f..242caf9 100644 --- a/version.rb +++ b/version.rb @@ -1,3 +1,3 @@ # frozen_string_literal: true -VERSION = '1.4.0' +VERSION = '1.4.1'