Showing 1,395 of 1,395 total issues
Method CFAppPush.getGitSCMSource
has 67 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (cfAppPush *CFAppPush) getGitSCMSource(clientWebSocket *websocket.Conn, tempDir string, msg SocketMessage, userGUID string) (StratosProject, string, error) {
var (
err error
)
Method portalProxy.doRequest
has 67 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (p *portalProxy) doRequest(cnsiRequest *interfaces.CNSIRequest, done chan<- *interfaces.CNSIRequest) {
log.Debugf("doRequest for URL: %s", cnsiRequest.URL.String())
var body io.Reader
var res *http.Response
var req *http.Request
Function login
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
login(username: string, password: string) {
// If this is a different user to last time, then logout first
if (SSOLoginPage.ssoLastUsername && SSOLoginPage.ssoLastUsername !== username) {
browser.waitForAngularEnabled(false);
this.logoutUAA();
Function createActionTableDate
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createActionTableDate(orgTarget, spaceTarget, stateIcon) {
return [{
user: userName,
action: 'remove_circle\nRemove',
role: 'Manager',
Function goNext
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
goNext() {
// Close previous error snackbar if there was one
if (this.snackBarRef) {
this.snackBar.dismiss();
}
Function ngOnInit
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
ngOnInit() {
const helmLastModifiedRegEx = /seconds:([0-9]*)/;
this.sessionData$ = this.store.select(s => s.auth).pipe(
Method portalProxy.getInfo
has 66 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (p *portalProxy) getInfo(c echo.Context) (*interfaces.Info, error) {
// get the version
versions, err := p.getVersionsData()
if err != nil {
return nil, errors.New("Could not find database version")
Function setupAutoSelectors
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
private setupAutoSelectors(initialCf: string, initialOrg: string) {
// Clear or automatically select org + space given cf
let cfTapped = false;
const orgResetSub = this.cf.select.asObservable().pipe(
startWith(initialCf),
Function ngOnInit
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
ngOnInit() {
this.isOrgRole = !this.spaceGuid;
const users$ = this.store.select(selectCfUsersRolesPicked);
// If setting an org role user must be admin or org manager.
// If setting a space role user must be admin, org manager or space manager
Function createLocalPageObservable
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
private createLocalPageObservable(
pagination$: Observable<PaginationEntityState>,
schema: normalizrSchema.Entity,
fetching$: Observable<boolean>
) {
Function hasUpgrade
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public hasUpgrade(returnLatest = false): Observable<InternalHelmUpgrade> {
const updates = combineLatest(this.getCharts(), this.release$);
return updates.pipe(
map(([charts, release]) => {
let score = -1;
Function constructor
has 41 lines of code (exceeds 25 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;
Method MetricsSpecification.getMetricsEndpoints
has 65 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (m *MetricsSpecification) getMetricsEndpoints(userGUID string, cnsiList []string) (map[string]EndpointMetricsRelation, error) {
metricsProviders := make([]MetricsMetadata, 0)
endpointsMap := make(map[string]*interfaces.ConnectedEndpoint)
results := make(map[string]EndpointMetricsRelation)
Function testEntityMissingEntityRequired
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
function testEntityMissingEntityRequired(done: () => void) {
const getOrgAction = new GetOrganization(
orgGuid,
cfGuid,
[createEntityRelationKey(organizationEntityType, quotaDefinitionEntityType)],
Function parse
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
parse(content) {
const prepareRegexes = this.prepareRegexes.bind(this);
return content.split('\n')
.map(line => {
line = line.trim();
Function handleFileInputSelection
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
handleFileInputSelection(items): Observable<FileScannerInfo> {
const obs$ = new BehaviorSubject<DeployApplicationFSScanner>(undefined);
let scanner = new DeployApplicationFSScanner(CF_DEFAULT_IGNORES);
let cfIgnoreFile;
let manifestFile = false;
Function mapMultiEndpointResponses
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function mapMultiEndpointResponses(
action: EntityRequestAction,
catalogEntity: StratosBaseCatalogEntity,
requestType: ApiRequestTypes,
multiEndpointResponses: HandledMultiEndpointResponse,
Function processSingleItemDeleteAction
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
private processSingleItemDeleteAction<T extends BasicKubeAPIResource>(action: KubeAction, url: string) {
this.store.dispatch(new StartRequestAction(action, 'delete'));
const headers = new HttpHeaders({
'x-cap-cnsi-list': action.kubeGuid,
'x-cap-passthrough': 'true'
Similar blocks of code found in 2 locations. Consider refactoring. Open
describe('KubernetesGKEAuthFormComponent', () => {
let component: KubernetesGKEAuthFormComponent;
let fixture: ComponentFixture<KubernetesGKEAuthFormComponent>;
beforeEach(async(() => {
- 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 222.
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
describe('KubernetesConfigAuthFormComponent', () => {
let component: KubernetesConfigAuthFormComponent;
let fixture: ComponentFixture<KubernetesConfigAuthFormComponent>;
beforeEach(async(() => {
- 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 222.
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