Showing 133 of 133 total issues
Method start
has a Cognitive Complexity of 65 (exceeds 20 allowed). Consider refactoring. Open
@Throws(IOException::class, InterruptedException::class)
fun start() {
LOG.debug("Starting Restful service server")
val mainCtx = createJSContext(REST_RUNNER)
val rawConfig = mainCtx.eval("js", "JSON.stringify(getConfig())").toString()
- 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
Function processRoute
has 120 lines of code (exceeds 25 allowed). Consider refactoring. Open
async processRoute (transaction, request, route, routeInfo) {
LOG.debug('Incoming request <== \n' + request)
try {
// Request origin transport
const originTransport = request
Method start
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Throws(IOException::class, InterruptedException::class)
fun start() {
LOG.debug("Starting Restful service server")
val mainCtx = createJSContext(REST_RUNNER)
val rawConfig = mainCtx.eval("js", "JSON.stringify(getConfig())").toString()
Function exports
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = upSince => {
const config = {
system: {
upSince,
version,
Function sendResponse
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
async sendResponse (event) {
LOG.debug(
`core.processor.ResponseProcessor.sendResponse [Inconming response <=]`
)
LOG.debug(event.getResponse())
File request_utils.js
has 314 lines of code (exceeds 250 allowed). Consider refactoring. Open
const LocatorUtils = require('@routr/location/utils')
const { isLocalnet } = require('@routr/core/ip_util')
const { equalsIgnoreCase, fixPort } = require('@routr/utils/misc_utils')
const { RoutingType } = require('@routr/core/routing_type')
const config = require('@routr/core/config_util')()
Similar blocks of code found in 3 locations. Consider refactoring. Open
it('should have a valid transport', () => {
jsonObj.spec.transport = 'tcpx'
const result = DSUtils.validateEntity(jsonObj)
expect(result)
.to.be.a('array')
- 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 101.
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 3 locations. Consider refactoring. Open
it('should have a name with three or more characters', () => {
jsonObj.metadata.name = 'ab'
const result = DSUtils.validateEntity(jsonObj)
expect(result)
.to.be.a('array')
- 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 101.
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 3 locations. Consider refactoring. Open
it('should have a reference with three but no more than 25', () => {
jsonObj.metadata.ref = 'sdsdkskskdksksdksksdkdksdksdkskdksdk'
const result = DSUtils.validateEntity(jsonObj)
expect(result)
.to.be.a('array')
- 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 101.
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
File files_datasource.js
has 281 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* @author Pedro Sanders
* @since v1
*/
const CoreUtils = require('@routr/core/utils')
File request_handler.js
has 274 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* @author Pedro Sanders
* @since v1
*/
const { connectionException } = require('@routr/utils/exception_helpers')
Function exports
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = (registry, sipStack, gatewaysAPI) => {
const SipListener = Java.extend(Java.type('javax.sip.SipListener'))
const store = new StoreAPI(SDSelector.getDriver())
return new SipListener({
processResponse: event => {
Function process
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
async process (event) {
const request = event.getRequest()
let transaction = event.getServerTransaction()
if (
Function doProcess
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
doProcess (transaction) {
this.quanrentineHosts = this.quanrentineHosts.filter(quarentine)
LOG.debug(
'List of gateways in quarantine: ' +
Function getRoutingType
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
getRoutingType () {
let routingType = RoutingType.UNKNOWN
const callerType = this.getCallerType()
const calleetype = this.getCalleeType()
const belongToSameDomain = this.isSameDomain()
Similar blocks of code found in 3 locations. Consider refactoring. Open
getDomainByUri (domainUri) {
let response = this.cache.getIfPresent(domainUri)
if (response === null) {
response = DSUtils.deepSearch(
- 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 82.
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 3 locations. Consider refactoring. Open
getPeerByUsername (username) {
let response = this.cache.getIfPresent(username)
if (response === null) {
response = DSUtils.deepSearch(
- 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 82.
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 3 locations. Consider refactoring. Open
getGatewayByHost (host) {
let response = this.cache.getIfPresent(host)
if (response === null) {
response = DSUtils.deepSearch(this.getGateways(), 'spec.host', host)
- 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 82.
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 processResponse
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
processResponse: event => {
const response = event.getResponse()
const gwURI = response
.getHeader(FromHeader.NAME)
.getAddress()
Function listener
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
get listener () {
return new SipListener({
processRequest: event => {
try {
this.requestProcessor.process(event)