Showing 21 of 37 total issues
File SolidService.ts
has 619 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import {
DataFrame,
DataObject,
DataServiceDriver,
MemoryDataService,
Function handleRedirect
has 114 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected async handleRedirect(session?: SolidSession): Promise<ISessionInfo> {
try {
const url = new URL(window.location.href);
// Check if can process
if (url.searchParams.get('code') === null && url.searchParams.get('state') === null) {
SolidService
has 31 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export abstract class SolidService extends RemoteService {
protected options: SolidDataServiceOptions;
storage: IStorage;
protected storageUtility: StorageUtility;
readonly clientRegistrar: ClientRegistrar;
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 insert
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
insert(_, object: T): Promise<T> {
return new Promise((resolve, reject) => {
if (!object.webId) {
if (this.service.session) {
object.webId = this.service.session.info.webId;
File SolidDataDriver.ts
has 259 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { DataFrame, DataObject, Model, Constructor, FindOptions, FilterQuery, Serializable } from '@openhps/core';
import { SolidService, SolidSession } from './SolidService';
import { getSolidDataset, removeThing, saveSolidDatasetAt, Thing } from '@inrupt/solid-client';
import {
RDFSerializer,
File SolidClientService.ts
has 258 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { ISessionInfo, ISessionOptions, IStorage, Session } from '@inrupt/solid-client-authn-browser';
import { SolidProfileObject } from '../common';
import { SolidService, SolidDataServiceOptions, SolidSession, ISessionInternalInfo } from '../common/SolidService';
import {
buildAuthenticatedFetch,
Function handleLogin
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
handleLogin(): Promise<SolidSession> {
return new Promise((resolve, reject) => {
let storedSessionData: ISessionInfo & ISessionInternalInfo = undefined;
let session: SolidSession = undefined;
let sessionId: string = undefined;
Function handleRedirect
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
Open
protected async handleRedirect(session?: SolidSession): Promise<ISessionInfo> {
try {
const url = new URL(window.location.href);
// Check if can process
if (url.searchParams.get('code') === null && url.searchParams.get('state') === null) {
- 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 login
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
login(oidcIssuer: string = this.options.defaultOidcIssuer, interactive: boolean = false): Promise<Session> {
const session = this.createSession({
storage: this.storage,
});
if (!interactive) {
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 getClient
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async getClient(options: IClientRegistrarOptions, issuerConfig: IIssuerConfig): Promise<IClient> {
// If client secret and/or client id are stored in storage, use those.
const [storedClientId, storedClientSecret, storedClientName, storedClientType] = await Promise.all([
this.storageUtility.getForUser(options.sessionId, 'clientId', {
secure: false,
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 storeProfile
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
storeProfile(object: SolidProfileObject): Promise<SolidProfileObject> {
return new Promise((resolve, reject) => {
const key = `${SolidService.PREFIX}:webId:${object.webId}`;
this.storage
.set(key, object.sessionId)
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 findSessionById
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
findSessionById(sessionId: string): Promise<SolidSession> {
return new Promise((resolve, reject) => {
let session: SolidSession = undefined;
this.findSessionInfoById(sessionId)
.then((sessionInfo) => {
Function _onBuild
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private _onBuild(): Promise<void> {
return new Promise((resolve, reject) => {
if (this.options.authServer) {
if (!Object.keys(this.options.authServer).includes('port')) {
this.express = this.options.authServer as express.Express;
Function delete
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
delete(id: string): Promise<void> {
return new Promise((resolve, reject) => {
let uri: IriString;
let currentSession: SolidSession;
this.service
Function createThing
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
createThing(session: SolidSession, thing: Thing, dataset?: SolidDataset): Promise<SolidDataset> {
return new Promise((resolve, reject) => {
const documentURL = new URL(thing.url);
documentURL.hash = '';
/**