Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migration to typescript #48

Merged
merged 17 commits into from
Jul 19, 2021
Merged

migration to typescript #48

merged 17 commits into from
Jul 19, 2021

Conversation

vzakharchenko
Copy link
Owner

No description provided.

resource: {
name: 'Service 2 Resource',
},
export async function auth0(event:any) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

resource: {
name: 'Service 3 Resource',
},
export async function auth0(event:any) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.


import { getAuthentication } from './authorizerUtil';

function getKeycloakJSON() {
function getKeycloakJSON():any {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.


import { getAuthentication } from './authorizerUtil';
import { fetchData } from './restCalls';

function getKeycloakJSON() {
function getKeycloakJSON():any {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

});
});

app.get('/expressServiceApi2', keycloakAdapter.getExpressMiddlewareAdapter().middleware({
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

@vzakharchenko vzakharchenko linked an issue Jul 17, 2021 that may be closed by this pull request
},
enforce: {
enabled: true,
export async function auth0(event:any) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

uri: 'LambdaResource123',
matchingUri: true,
},
export async function auth0(event:any) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

@@ -26,8 +42,8 @@ function getToken(event) {
return jsonwebtoken.decode(tokenStringValue);
}

export function hello(event, context, callback) {
const token = getToken(event);
export function hello(event:any, context:any, callback:any) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

@@ -26,8 +34,8 @@ function getToken(event) {
return jsonwebtoken.decode(tokenStringValue);
}

export function hello(event, context, callback) {
const token = getToken(event);
export function hello(event:any, context:any, callback:any) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.


app.use(bodyParser.urlencoded({ extended: true }));

app.get('/expressServiceApi1', keycloakAdapter.getExpressMiddlewareAdapter().middleware({
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

} if (region === 'resource') {
return resourceCache.get(key);
} if (region === 'rpt') {
return rptCache.get(key);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid too many return statements within this function.

return resources;
}

async matchResource(requestContent:RequestContent, enforcer?:Enforcer): Promise<any> {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function matchResource has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.

return tokenJson;
}

async keycloakRefreshToken(token: TokenJson,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function keycloakRefreshToken has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.

}
}

async getRPT(requestContent: RequestContent, enforcer:Enforcer): Promise<any> {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function getRPT has 32 lines of code (exceeds 25 allowed). Consider refactoring.

return tokenJson;
}

async keycloakRefreshToken(token: TokenJson,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function keycloakRefreshToken has 34 lines of code (exceeds 25 allowed). Consider refactoring.

}
}

async getRPT(requestContent: RequestContent, enforcer:Enforcer): Promise<any> {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function getRPT has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.

return tokenJson;
}

async keycloakRefreshToken(token: TokenJson,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function keycloakRefreshToken has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.

}
}

async getRPT(requestContent: RequestContent, enforcer:Enforcer): Promise<any> {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function getRPT has 32 lines of code (exceeds 25 allowed). Consider refactoring.

return tokenJson;
}

async keycloakRefreshToken(token: TokenJson,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function keycloakRefreshToken has 34 lines of code (exceeds 25 allowed). Consider refactoring.


import {getKeycloakUrl, getUrl} from './KeycloakUtils';

export function decodeToken(tokenString:string):JWTToken {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function decodeToken has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.

@coveralls
Copy link

coveralls commented Jul 18, 2021

Coverage Status

Coverage increased (+8.07%) to 99.482% when pulling 8ff57d5 on typescript into b25ad56 on master.

return resources;
}

async matchResource(requestContent:RequestContent, enforcer?:Enforcer): Promise<any> {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function matchResource has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.

return resources;
}

async matchResource(requestContent:RequestContent, enforcer?:Enforcer): Promise<any> {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function matchResource has 34 lines of code (exceeds 25 allowed). Consider refactoring.

throw new Error('Unsupported Region');
}

async put(region: string, key: string, value: any, ttl: number): Promise<void> {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function put has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.

}
return enf;
}
export function updateOptions(opts: AdapterDependencies): AdapterContent {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function updateOptions has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.

}
return enf;
}
export function updateOptions(opts: AdapterDependencies): AdapterContent {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function updateOptions has 36 lines of code (exceeds 25 allowed). Consider refactoring.

throw new Error('Unsupported Region');
}

put(region: string, key: string, value: any, ttl: number): void {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function put has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.

Copy link

@codeclimate codeclimate bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR diff size of 11463 lines exceeds the maximum allowed for the inline comments feature.

Copy link

@codeclimate codeclimate bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR diff size of 11466 lines exceeds the maximum allowed for the inline comments feature.

Copy link

@codeclimate codeclimate bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR diff size of 11602 lines exceeds the maximum allowed for the inline comments feature.

Copy link

@codeclimate codeclimate bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR diff size of 11740 lines exceeds the maximum allowed for the inline comments feature.

Copy link

@codeclimate codeclimate bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR diff size of 11767 lines exceeds the maximum allowed for the inline comments feature.

Copy link

@codeclimate codeclimate bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR diff size of 11779 lines exceeds the maximum allowed for the inline comments feature.

Copy link

@codeclimate codeclimate bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR diff size of 12243 lines exceeds the maximum allowed for the inline comments feature.

Copy link

@codeclimate codeclimate bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR diff size of 12487 lines exceeds the maximum allowed for the inline comments feature.

Copy link

@codeclimate codeclimate bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR diff size of 15326 lines exceeds the maximum allowed for the inline comments feature.

Copy link

@codeclimate codeclimate bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR diff size of 8774 lines exceeds the maximum allowed for the inline comments feature.

Copy link

@codeclimate codeclimate bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR diff size of 8774 lines exceeds the maximum allowed for the inline comments feature.

@codeclimate
Copy link

codeclimate bot commented Jul 19, 2021

Code Climate has analyzed commit 8ff57d5 and detected 0 issues on this pull request.

View more on Code Climate.

@vzakharchenko vzakharchenko merged commit 41d351b into master Jul 19, 2021
@vzakharchenko vzakharchenko deleted the typescript branch July 19, 2021 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create typings
2 participants