Showing 11 of 19 total issues
File SolidService.ts
has 389 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import {
DataFrame,
DataObject,
DataServiceDriver,
MemoryDataService,
SolidService
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export abstract class SolidService extends RemoteService implements IStorage {
protected options: SolidDataServiceOptions;
protected driver: DataServiceDriver<string, string>;
model: Model<any, any>;
private static readonly PREFIX = 'OpenHPS:solid';
Function getDatasetStore
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
getDatasetStore(session: SolidSession, uri: string): Promise<Store> {
return new Promise((resolve, reject) => {
/**
*
* @param subject
Function convertPredicates
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function convertPredicates(subject: Quad_Subject, predicates: any): Quad[] {
return Object.keys(predicates)
.map((key) => {
const predicate = DataFactory.namedNode(key);
const objects: Quad_Object[] = [];
Function bundle
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
const bundle = (env, module, entry = 'index', suffix = '') => {
const filename = `${PROJECT_NAME}${suffix}${module ? ".es" : ""}${env.prod ? ".min" : ""}`;
return {
name: PROJECT_NAME,
entry: `./dist/esm5/${entry}.js`,
- 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 bundle
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const bundle = (env, module, entry = 'index', suffix = '') => {
const filename = `${PROJECT_NAME}${suffix}${module ? ".es" : ""}${env.prod ? ".min" : ""}`;
return {
name: PROJECT_NAME,
entry: `./dist/esm5/${entry}.js`,
Function _initialize
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private _initialize(): Promise<void> {
return new Promise((resolve, reject) => {
if (this.options.autoLogin) {
this.login(this.options.defaultOidcIssuer)
.then(() => resolve())
Function loginSuccessCallback
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
loginSuccessCallback: async function(req: express.Request, res: express.Response, sessionInfo: any) {
const service: SolidService = this;
const session = await service.findSessionByWebId(sessionInfo.webId);
const card = await service.getThing(session, sessionInfo.webId);
Function interactiveLogin
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
interactiveLogin(oidcIssuer: string = this.options.defaultOidcIssuer): Promise<Session> {
const session = new Session({
insecureStorage: this,
secureStorage: this,
});
Function findSessionById
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
findSessionById(sessionId: string): Promise<Session> {
return new Promise((resolve, reject) => {
const clientAuth = getClientAuthenticationWithDependencies({
secureStorage: this,
insecureStorage: this,
Function getDocumentURL
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
getDocumentURL(session: SolidSession, path?: string): URL {
const podURL = new URL(session.info.webId.replace('/profile/card#me', ''));
const documentURL = new URL(session.info.webId);
if (path) {
const filteredPath = (podURL.pathname.length > 1 ? podURL.pathname : '') + path.replace(podURL.href, '');
- 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"