Showing 650 of 1,370 total issues
Avoid deeply nested control flow statements. Open
if err != nil {
if ok, detail := isSSLRelatedError(err); ok {
return interfaces.NewHTTPShadowError(
http.StatusForbidden,
"SSL error - "+detail,
Function init
has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring. Open
func init() {
RegisterMigration(20180413135700, "MetricsSchema", func(txn *sql.Tx, conf *goose.DBConf) error {
if strings.Contains(conf.Driver.Name, "sqlite3") {
// SQLite does not support MODIFY on ALTER TABLE - but fortunately it doesn't mind about the column sizes
return nil
- 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 PgsqlLocalUsersRepository.UpdateLocalUser
has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring. Open
func (p *PgsqlLocalUsersRepository) UpdateLocalUser(user interfaces.LocalUser) error {
log.Debug("UpdateLocalUser")
//Validate args
var err error
- 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
Avoid deeply nested control flow statements. Open
if strings.HasPrefix(authToken, "bearer ") {
authToken = authToken[7:]
}
Method CloudFoundrySpecification.openNoaaConsumer
has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring. Open
func (c CloudFoundrySpecification) openNoaaConsumer(echoContext echo.Context) (*AuthorizedConsumer, error) {
ac := &AuthorizedConsumer{}
// Get the CNSI and app IDs from route parameters
- 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 portalProxy.buildCNSIRequest
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
func (p *portalProxy) buildCNSIRequest(cnsiGUID string, userGUID string, method string, uri *url.URL, body []byte, header http.Header) (interfaces.CNSIRequest, error) {
Method PgsqlTokenRepository.SaveAuthToken
has 7 return statements (exceeds 4 allowed). Open
func (p *PgsqlTokenRepository) SaveAuthToken(userGUID string, tr interfaces.TokenRecord, encryptionKey []byte) error {
log.Debug("SaveAuthToken")
if userGUID == "" {
msg := "Unable to save Auth Token without a valid User GUID."
log.Debug(msg)
Method PgsqlTokenRepository.findCNSIToken
has 7 return statements (exceeds 4 allowed). Open
func (p *PgsqlTokenRepository) findCNSIToken(cnsiGUID string, userGUID string, encryptionKey []byte, includeDisconnected bool) (interfaces.TokenRecord, error) {
log.Debug("findCNSIToken")
if cnsiGUID == "" {
msg := "Unable to find CNSI Token without a valid CNSI GUID."
log.Debug(msg)
Function constructor
has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring. Open
constructor(
private store: Store<CFAppState>,
private activeRouteCfOrgSpace: ActiveRouteCfOrgSpace,
private cfUserService: CfUserService,
private route: ActivatedRoute
- 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 constructor
has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring. Open
constructor(dir: string, options?: any, loggingEnabled = true) {
this.angularJsonFile = this.findFileOrFolderInChain(dir, 'angular.json');
this.angularJson = JSON.parse(fs.readFileSync(this.angularJsonFile, 'utf8').toString());
this.loggingEnabled = loggingEnabled;
- 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 apply
has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring. Open
public apply(src: string): string {
// Patch different page title if there is one
const title = this.config.stratosConfig.title || 'Stratos';
src = src.replace(/@@TITLE@@/g, title);
- 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
Avoid deeply nested control flow statements. Open
if (scExtState) {
extState = scExtState;
} else {
extState = pkgState + '(' +
this.formatCount(counts.running) + ',' +
Function constructor
has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring. Open
constructor(
public activatedRoute: ActivatedRoute,
public kubeEndpointService: KubernetesEndpointService
) {
this.podName = activatedRoute.snapshot.params.podName;
- 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 dashboardReducer
has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring. Open
export function dashboardReducer(state: DashboardState = defaultDashboardState, action): DashboardState {
switch (action.type) {
case OPEN_SIDE_NAV:
if (state.isMobile) {
return { ...state, isMobileNavOpen: 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
Avoid deeply nested control flow statements. Open
if (!resources[entityType]) {
resources[entityType] = [];
}
Function deleteEntity
has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring. Open
function deleteEntity(state, entityKey, guid) {
const newState = {} as Record<string, any>;
for (const entityTypeKey in state) {
if (entityTypeKey === entityKey) {
newState[entityTypeKey] = {};
- 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 constructor
has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring. Open
constructor(private store: Store<AppState>, private activatedRoute: ActivatedRoute) {
// Determine the starting state of the filter by repo section
stratosEntityCatalog.endpoint.store.getAll.getPaginationService().entities$.pipe(
filter(entities => !!entities),
first()
- 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 failApiRequest
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
store: Store<T>,
apiAction: EntityRequestAction,
error,
catalogEntity: StratosBaseCatalogEntity,
requestType: ApiRequestTypes = 'fetch',
Function getObservables
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
store: Store<GeneralEntityAppState>,
entityKey: string,
paginationKey: string,
paginationAction: PaginatedAction | PaginatedAction[],
paginationMonitor: PaginationMonitor,
Function editModeChanged
has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring. Open
editModeChanged(mode) {
this.mode = mode.value;
if (this.mode === EditorMode.CodeEditor) {
// Form -> Editor
- 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"