Showing 198 of 403 total issues
Method disjoinConditions
has a Cognitive Complexity of 98 (exceeds 5 allowed). Consider refactoring. Open
private synchronized List<LineEntry> disjoinConditions(final List<LineEntry> rules){
final ArrayList<List<LineEntry>> branches = new ArrayList<>(0);
final List<LineEntry> finalRules = new ArrayList<>(0);
final StringBuilder condition = new StringBuilder();
boolean restart = true;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method writeDuplicates
has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring. Open
private void writeDuplicates(final File duplicatesFile, final Collection<List<Duplicate>> duplicates){
final int totalSize = duplicates.size();
if(totalSize > 0){
LOGGER.info(ParserManager.MARKER_APPLICATION, "Write results to file (step 3/3)");
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method applyConversionTable
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
public final String applyConversionTable(final String word){
String convertedWord = word;
if(table != null){
final String inputWord = StringUtils.replace(word, StringUtils.SPACE, "_");
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method insert
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
private int insert(final List<IndexDataPair<RadixTrieNode>> siblings){
int begin = 0;
if(!siblings.isEmpty()){
int checkPos = Math.max(siblings.get(0).getIndex() + 1, nextCheckPos) - 1;
int nonZeroNum = 0;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method disjoinDifferentConditionLength
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
private static List<LineEntry> disjoinDifferentConditionLength(final List<List<LineEntry>> branches, final int branchIndex,
final Comparator<String> comparator){
final List<LineEntry> branch = branches.get(branchIndex);
final LineEntry parent = branch.get(0);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method generateCompounds
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
protected final List<List<List<Inflection>>> generateCompounds(final List<List<String>> permutations,
final Map<String, List<DictionaryEntry>> inputs){
final List<List<List<Inflection>>> entries = new ArrayList<>(0);
final Map<String, List<Inflection>> dicEntries = new HashMap<>(0);
outer:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method innerMarkDefaultStress
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
private static String innerMarkDefaultStress(String word){
int higherIndex = StringUtils.lastIndexOf(word, '’') - 1;
final int wordLength = word.length();
if(higherIndex < 0)
higherIndex = wordLength - 1;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method calculateBreakpoints
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
private static HyphenationBreak calculateBreakpoints(final String word, final AhoCorasickTrie<String> patterns,
final HyphenationOptions options){
final int wordSize = word.length();
final Map<Integer, IndexDataPair<String>> indexesAndRules = new HashMap<>(wordSize);
if(patterns != null){
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method applyAffixRule
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
private List<Inflection> applyAffixRule(final DictionaryEntry dicEntry, final String affix, final List<String> postponedAffixes,
final boolean isCompound, final RuleEntry overriddenRule) throws NoApplicableRuleException{
final AffixEntry[] appliedRules = dicEntry.getAppliedRules();
RuleEntry rule = affixData.getData(affix);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method perfectHash
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
public int perfectHash(final byte[] sequence, final int start, final int length, final int node){
if(!fsa.getFlags().contains(FSAFlags.NUMBERS))
throw new IllegalArgumentException("FSA not built with NUMBERS option.");
int hash = 0;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method extractAllAffixes
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
private List<Inflection> extractAllAffixes(final String word, final String partOfSpeech){
final List<Inflection> originatingRules = new ArrayList<>(0);
final DictionaryEntry nullDicEntry = dictionaryEntryFactory.createFromDictionaryLine(word);
final List<RuleEntry> ruleEntries = affixData.getRuleEntries();
final Collection<Inflection> originatingRulesFromEntry = new ArrayList<>(0);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method emitArcs
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
private boolean emitArcs(final FSAAbstract fsa, final OutputStream os, final int[] linearized, final int gtl, final int nodeDataLength)
throws IOException{
final ByteBuffer bb = ByteBuffer.allocate(Math.max(MAX_NODE_DATA_SIZE, MAX_ARC_SIZE));
int offset = 0;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method applyCompound
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
protected final List<Inflection> applyCompound(final List<List<List<Inflection>>> entries, final int limit){
final String compoundFlag = affixData.getCompoundFlag();
final String forbiddenWordFlag = affixData.getForbiddenWordFlag();
final String forceCompoundUppercaseFlag = affixData.getForceCompoundUppercaseFlag();
final boolean checkCompoundReplacement = affixData.isCheckCompoundReplacement();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method checkValidity
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
private void checkValidity(final AffixType parentType, final AffixType type, final String parentFlag, final String flag,
final String removal, final String line, final int index){
if(parentType != type)
throw new LinterException(WRONG_TYPE, parentType, type, line);
if(parentFlag != null && !parentFlag.equals(flag))
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method canApplyToSuffix
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
@SuppressWarnings("IfStatementMissingBreakInLoop")
private boolean canApplyToSuffix(final String word){
if(word.endsWith(condition))
return true;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method hasNeedAffixFlag
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
private static boolean hasNeedAffixFlag(final Inflection inflection, final String needAffixFlag){
boolean hasNeedAffixFlag = false;
final AffixEntry[] appliedRules = inflection.getAppliedRules();
if(appliedRules.length > 0){
//check that last suffix and last prefix don't have the needaffix flag
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method createHyphenatedWord
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
private static List<String> createHyphenatedWord(final String word, final HyphenationBreak hyphBreak){
int startIndex = 0;
int after = 0;
String addAfter = null;
final int size = word.length();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method canApplyToPrefix
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
@SuppressWarnings("IfStatementMissingBreakInLoop")
private boolean canApplyToPrefix(final String word){
if(word.startsWith(condition))
return true;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method calculateDictionaryBoundaries
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private void calculateDictionaryBoundaries(){
boundaries.clear();
try(final Scanner scanner = FileHelper.createScanner(dicFile.toPath(), charset)){
ParserHelper.assertLinesCount(scanner);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method mergeSimilarRules
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private static void mergeSimilarRules(final Collection<LineEntry> rules, final Comparator<String> comparator){
final Map<String, List<LineEntry>> similarityBucket = SetHelper.bucket(rules,
rule -> (rule.condition.contains(RegexHelper.GROUP_END)
? rule.removal + TAB + rule.addition + TAB + RegexSequencer.splitSequence(rule.condition)[0] + TAB
+ RegexSequencer.splitSequence(rule.condition).length
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"