Skip to content
This repository has been archived by the owner on Aug 3, 2024. It is now read-only.

Commit

Permalink
Fix some code inspection warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
rkrisztian committed Oct 1, 2020
1 parent fe1eb73 commit ed1b46d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 19 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ search for multiple patterns, Ack cannot replace text in files, and I don't care

1. Ack was written in Perl, and requires no extra modules to install. Mine was first written in
Perl too, but had to rewrite it in Groovy because it did use extra modules, and CPAN started
becoming unusable. While the Groovy code can use any Java library we want. Also Perl can be very
becoming unusable. While the Groovy code can use any Java library we want. Also, Perl can be very
complex and hard to read, and maintain.

Groovy definitely can't beat the speed of Perl. This is an example, where `sP` was the Perl
Expand Down Expand Up @@ -184,8 +184,8 @@ Uses Groovy syntax, see [ConfigSlurper](http://docs.groovy-lang.org/latest/html/

* `excludePatterns: List<String>`

List of regular expressions to exclude directory and file paths. You can of course use
slashy strings and dollar-slashy strings so you don't have to escape characters.
List of regular expressions to exclude directory paths and file paths. You can of course use
slashy strings and dollar-slashy strings, so you don't have to escape characters.

* `includeConfig: List<String>`

Expand Down Expand Up @@ -268,7 +268,7 @@ that are temporary files created by Eclipse to show history.)
$ git blame someFile | search - someAuthor
```

* Search in every files (including hidden ones):
* Search in every file (including hidden ones):

```text
$ s -a - myproject
Expand All @@ -285,13 +285,13 @@ that are temporary files created by Eclipse to show history.)

```text
$ s \* - 'jQuery' -r '$'
```
```

* Search for `jQuery` and replace each occurrence with `$`, but only in files including a script tag:

```text
$ s \* - 'jQuery' -r '$' '<script'
```
```

## How to contribute

Expand All @@ -310,7 +310,7 @@ that are temporary files created by Eclipse to show history.)
5. Read some docs:

* [Groovy Language Documentation](http://docs.groovy-lang.org/latest/html/documentation/)
* [Style guide](www.groovy-lang.org/style-guide.html) (not followed entirely yet)
* [Style guide](http://www.groovy-lang.org/style-guide.html) (not followed entirely yet)

## To do

Expand Down
9 changes: 0 additions & 9 deletions search-app/src/main/groovy/search/conf/ConfigParser.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ class ConfigParser {

protected static final String PROPERTY_PRINT_HTML = 'printHtml'

@Deprecated
protected static final String PROPERTY_EXCLUDE_PATTERNS = 'excludePatterns'

protected final Conf conf

protected final ILog log
Expand Down Expand Up @@ -62,12 +59,6 @@ class ConfigParser {
conf.excludeFilePatterns.addAll 0,
currentConfig[PROPERTY_EXCLUDE_FILE_PATTERNS].collect { String it -> ~it }
}
if (currentConfig[PROPERTY_EXCLUDE_PATTERNS]) {
log.warn "Property '${PROPERTY_EXCLUDE_PATTERNS}' is deprecated, use " +
"'${PROPERTY_EXCLUDE_FILE_PATTERNS}' instead"
conf.excludeFilePatterns.addAll 0,
currentConfig[PROPERTY_EXCLUDE_PATTERNS].collect { String it -> ~it }
}
if (currentConfig[PROPERTY_MAX_CONTEXT_LINES] && (conf.maxContextLines == null)) {
conf.maxContextLines = currentConfig[PROPERTY_MAX_CONTEXT_LINES] as Integer
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class LinesCollector implements ILinesCollector {
contextLinesAfter: new LinkedList<String>(), contextLinesAfterOverflow: false)
}

private FoundLine makeSkippedLinesMarker() {
private static FoundLine makeSkippedLinesMarker() {
new FoundLine(
lineNr: -1, line: '', contextLinesBefore: new LinkedList<String>(),
contextLinesBeforeOverflow: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class ConsoleResultsPrinterTest {
assert log.loggedLines.any { it =~ /This is a test!/ }
}

private Set<PatternData> makePatternData(Map[] patterns) {
private static Set<PatternData> makePatternData(Map[] patterns) {
patterns.collect { pattern ->
[
searchPattern : pattern.pattern,
Expand All @@ -146,7 +146,7 @@ class ConsoleResultsPrinterTest {
}
}

private List<FoundLine> makeFoundLines(String[] lines) {
private static List<FoundLine> makeFoundLines(String[] lines) {
lines.collect { line ->
[line: line] as FoundLine
}
Expand Down

0 comments on commit ed1b46d

Please sign in to comment.