File Verifier.java
has 362 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* Verifier.java
Purpose:
Description:
Method checkCharacterData
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public static final void checkCharacterData(String text, Locator loc) {
if (text == null)
throw new DOMException(DOMException.INVALID_CHARACTER_ERR,
"A null is not a legal XML value", loc);
- 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 isXMLExtender
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public static boolean isXMLExtender(final char c) {
/*
* This function is not accellerated by the bitmask system because
* there are no longer any actual calls to it from the JDOM code.
* It used to be called by the isXMLNameCharacter() method before
- 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 checkNamespacePrefix
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public static final void checkNamespacePrefix(String prefix, Locator loc) {
if (prefix == null || prefix.length() == 0)
return; //OK: null or empty
String reason = 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 checkCharacterData
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static final void checkCharacterData(String text, Locator loc) {
if (text == null)
throw new DOMException(DOMException.INVALID_CHARACTER_ERR,
"A null is not a legal XML value", loc);
Method checkNamespacePrefix
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static final void checkNamespacePrefix(String prefix, Locator loc) {
if (prefix == null || prefix.length() == 0)
return; //OK: null or empty
String reason = null;
Avoid too many return
statements within this method. Open
if (c < 0x309D) return false; if (c <= 0x309E) return true;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
if (c == 0x0387) return true;
Avoid too many return
statements within this method. Open
if (c == 0x0640) return true;
Avoid too many return
statements within this method. Open
if (c < 0x3031) return false; if (c <= 0x3035) return true;
Avoid too many return
statements within this method. Open
if (c < 0x309D) return false; if (c <= 0x309E) return true;
Avoid too many return
statements within this method. Open
if (c < 0x30FC) return false; if (c <= 0x30FE) return true;
Avoid too many return
statements within this method. Open
if (c == 0x3005) return true;
Avoid too many return
statements within this method. Open
if (c == 0x0EC6) return true;
Avoid too many return
statements within this method. Open
if (c < 0x30FC) return false; if (c <= 0x30FE) return true;
Avoid too many return
statements within this method. Open
if (c == 0x0E46) return true;
Avoid too many return
statements within this method. Open
if (c < 0x3031) return false; if (c <= 0x3035) return true;
Method checkNamespaceURI
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static final void checkNamespaceURI(String uri, Locator loc) {
if (uri == null || uri.length() == 0)
return; //OK: null or empty
String reason = 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 checkXMLName
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static void checkXMLName(String name, Locator loc) {
if (name == null || name.length() == 0)
throw new DOMException(DOMException.INVALID_CHARACTER_ERR,
"XML names cannot be null or empty", loc);
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
private static final byte[] VALCONST = new byte[] {
0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x41, 0x01,
0x41, 0x49, 0x41, 0x59, 0x41, 0x01, 0x41, 0x01,
0x41, 0x4f, 0x01, 0x4d, 0x01, 0x4f, 0x01, 0x41,
0x01, 0x09, 0x01, 0x0f, 0x01, 0x0f, 0x01, 0x0f,
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 1254.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
private static final int [] LENCONST = new int [] {
9, 2, 2, 1, 18, 1, 1, 2,
9, 2, 1, 10, 1, 2, 1, 1,
2, 26, 4, 1, 1, 26, 3, 1,
56, 1, 8, 23, 1, 31, 1, 58,
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 1254.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76