Skip to content

Commit

Permalink
Fixed the default value of the additional_lines option (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
NikkelM authored Feb 28, 2024
1 parent 959067f commit 08b22b6
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
8 changes: 4 additions & 4 deletions .github/config.yml
Original file line number Diff line number Diff line change
@@ -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']
Expand All @@ -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
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
# Changelog

## v1.4.0
## v1.4.1

<!--Releasenotes start-->
- Fixed the default value of the `additional_lines` configuration option not being set to 1.
<!--Releasenotes end-->

## 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.
<!--Releasenotes end-->

## v1.3.2

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]]`</br>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` |

<details>
Expand Down
2 changes: 1 addition & 1 deletion app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# frozen_string_literal: true

VERSION = '1.4.0'
VERSION = '1.4.1'

0 comments on commit 08b22b6

Please sign in to comment.