Skip to content

Conversation

@Liana2707
Copy link
Contributor

No description provided.

Liana2707 added 2 commits June 6, 2022 18:21
…ultipleListsPredicates,multipleListsPredicatesWithDocument in ListRule.kt and ListRuleBuilder.kt
val hardConfigurationWords: MutableList<String> = mutableListOf()
File(fileConfigurationWordsName).forEachLine { hardConfigurationWords.add(it) }

lines.forEach { line -> line.text.forEach {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is preferred to use functional approach

Suggestion: use map, filter and reduce instead of for loop

}
}

if (wordCount < precisionWordCount)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is preferred to use explicit return statements

if (word!="Заключение")
linesIndexes.first <= it.documentIndex && it.documentIndex < linesIndexes.second
else linesIndexes.first <= it.documentIndex
}.toMutableList()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is preferred to use "toList" if list isn't supposed to be modified

linesFilters.forEach { lines = it(lines, document) }

if (lines.isNotEmpty()) {
singleLinePredicates.forEach { predicate ->
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is preferred to use a single add method by using functional approach with map, reduce, filter and flatten instead of forEach

type,
region,
name)
} No newline at end of file
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants