Showing 111 of 111 total issues
Method getRemoteIP
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private String getRemoteIP(HttpServletRequest request) {
// System.out.println("*****************" + request.getRemoteAddr());
// for(Enumeration<String> headerNames = request.getHeaderNames() ; headerNames.hasMoreElements(); ) {
// String headerName = headerNames.nextElement();
// System.out.println(headerName + "=" + request.getHeader(headerName));
- 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 values
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
public ReviewsRecord values(Integer value1, Integer value2, Integer value3, String value4, Timestamp value5, Timestamp value6, Integer value7, String value8, Integer value9, Integer value10, Integer value11) {
Identical blocks of code found in 2 locations. Consider refactoring. Open
function loadTags() {
TagService.get({selectedOffice:$scope.data.selectedOffice.id}).then(function(data) {
$scope.allTags = data;
});
}
- 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 62.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
function loadTags() {
TagService.get({selectedOffice:$scope.data.selectedOffice.id}).then(function(data) {
$scope.allTags = data;
});
}
- 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 62.
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
Function PasswordStrengthService
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
var PasswordStrengthService = function(emptyAllowed) {
this.passStrength = null;
this.passStrengthClass = null;
this.emptyAllowed = emptyAllowed ? true : false;
Method getHtml
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static String getHtml(UsersRecord rec, List<UpdatesQuery> updates, List<MailImage> images) {
StringBuilder body = new StringBuilder("<html><head><meta charset='utf-8'><style>" + HEAD_STYLE + "</style></head><body style='" + BODY_STYLE
+ "'>");
body.append("<div id='main' style='" + CONTENT_DIV_STYLE + "'>");
body.append("<h2>" + MessageFormat.format(greeting, rec.getDisplayname()) + "</h2>").append(BR);
- 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
if (options.format === 'shorthex') {
return '#' + (isGrayscale ? gray(this.hash({length: 1})) : this.hash({length: 3}));
}
- 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 60.
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
Method init
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private void init() {
sourceLocation = System.getProperty(LUNCHY_PROPERTIES);
if (sourceLocation != null) {
try {
if (sourceLocation.startsWith("memory:")) {
- 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
if (options.format === 'hex') {
return '#' + (isGrayscale ? gray(this.hash({length: 2})) : this.hash({length: 6}));
}
- 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 60.
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
Method getPoolDSJMXName
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static ObjectName getPoolDSJMXName() {
try {
ObjectName registryName = new ObjectName("com.mchange.v2.c3p0:type=C3P0Registry,name=C3P0DBConnection");
MBeanInfo registry = mbs.getMBeanInfo(registryName);
for (MBeanAttributeInfo mba : registry.getAttributes()) {
- 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 getText
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static String getText(UsersRecord rec, List<UpdatesQuery> updates, List<MailImage> images) {
StringBuilder body = new StringBuilder();
body.append(MessageFormat.format(greeting, rec.getDisplayname())).append(CR);
body.append(CR);
if (updates.isEmpty()) {
Function getData
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
getData: function($defer, params) {
// HACK: seems like the first parameter of NgTableParams doesn't respect page
if(initPage!=null) {
if(initPage!=params.page()){
Method store
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void store(String action, String context, HttpServletRequest request, LongTimeToken longTimeToken) {
String userAgent = request.getHeader("User-Agent");
if(userAgent != null && userAgent.startsWith("kube-probe/")) {
// do not log the health-check
return;
Function link
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
link: function(scope, elem, attr, ngModelCtrl) {
var fieldName = attr.unique;
if(fieldName!="email" && fieldName!="domain") {
console.log("unique needs to be email/domain"); return;
}
Method fixRotation
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private BufferedImage fixRotation() throws IOException {
BufferedImage tmpImg = originalImage;
// http://sylvana.net/jpegcrop/exif_orientation.html
switch (getOrientation(getBufferedInputStream())) {
case 1:
Method init
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void init() {
sourceLocation = System.getProperty(LUNCHY_PROPERTIES);
if (sourceLocation != null) {
try {
if (sourceLocation.startsWith("memory:")) {
Similar blocks of code found in 2 locations. Consider refactoring. Open
$scope.officeMarker = [{
coords: {
latitude: off.geoLat,
longitude: off.geoLng
},
- 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 57.
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
return [{
coords: {
latitude: officeObj.geoLat,
longitude: officeObj.geoLng
},
- 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 57.
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
Method run
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public void run() {
File toWatch = new File(sourceLocation);
log.info("PropertyFileWatcher started");
try {
final Path path = FileSystems.getDefault().getPath(toWatch.getParent());
- 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 query
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public List<QueryResponse> query(Set<String> tags, Set<String> partners, Integer maxTime, Integer selectedMinRating, int fkCommunity,
Integer fkCurrentUser, int selectedOffice) {
Result<LocationRecord> locations = queryLocations(tags, maxTime, fkCommunity, selectedOffice);
Result<Record> reviews = queryReviews(partners, getLocationId(locations), fkCurrentUser);