Showing 62 of 157 total issues
Function convertSingleValue
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
convertSingleValue(
sourceObject: any,
typeDescriptor: TypeDescriptor,
memberName: string,
memberOptions?: ObjectMemberMetadata,
Function generateComparisonSelector
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected generateComparisonSelector<T>(
selector: string,
subquery: QuerySelector<T>,
predicate: IriString,
dataType: Serializable<any>,
Function createInsert
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
createInsert(object: T): string {
const changelog = RDFSerializer.serializeToChangeLog(object, {
baseUri: this.baseUri,
});
const generator = new SparqlGenerator();
Function convertSingleValue
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
Open
convertSingleValue(
sourceObject: any,
typeDescriptor: TypeDescriptor,
memberName: string,
memberOptions?: ObjectMemberMetadata,
- 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 createDelete
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
createDelete(id: IriString): string {
const generator = new SparqlGenerator();
const identifierMember = RDFSerializer.getUriMetadata(this.dataType);
const query: SparqlQuery = {
type: 'update',
Function convertSingleValue
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
convertSingleValue(
sourceObject: any,
typeDescriptor: TypeDescriptor,
knownTypes: Map<string, Serializable<any>>,
memberName = 'object',
Function delete
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
delete(
predicate: IriString,
object: Quad_Object | Thing | number | string | IriString | object,
languageOrDatatype?: string | IriString,
): RDFBuilder {
Function externals
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
externals: function (_, request, callback) {
const knownExternals = {
'@openhps/core': {
module: "./openhps-core.es" + (env.prod ? ".min" : "") + ".js",
commonjs: '@openhps/core',
Function deserializer
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
deserializer: (object: any) => {
if (!object) {
return undefined;
}
Function deserializeMap
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
deserializeMap(
sourceObject: Quad_Object[],
typeDescriptor: MapTypeDescriptor,
knownTypes: Map<string, Serializable<any>>,
memberName: string,
Function deserializeObject
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
deserializeObject<T>(
sourceObject: Thing,
typeDescriptor: TypeDescriptor,
knownTypes: Map<string, Serializable<any>>,
_: string,
- 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 createChangeLog
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function createChangeLog(store: Store): Store & RDFChangeLog {
// Add a changelog to the store
(store as any).additions = [];
(store as any).deletions = [];
Function createDeleteAll
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
createDeleteAll(query: FilterQuery<T>): string {
const generator = new SparqlGenerator();
const sparqlQuery: SparqlQuery = {
type: 'update',
prefixes: {
Function processClass
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static processClass(nodeType: any): Promise<[string, string]> {
return new Promise((resolve, reject) => {
const url = `https://openhps.org/terms/procedure/${nodeType.name}`;
const builder = RDFBuilder.namedNode(url as IriString)
.add(rdfs.label, nodeType.name, "en");
Function add
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
add(
predicate: IriString,
object: Quad_Object | Thing | number | string | IriString | object,
languageOrDatatype?: string | IriString,
): RDFBuilder {
Function fetchRemoteData
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function fetchRemoteData(url: string, namespace: string): Promise<Quad[]> {
const response = await axios.get(url, {
headers: {
'Accept': 'text/turtle;q=0.9, application/rdf+xml;q=0.8',
},
Function get
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
get: (obj: Store & RDFChangeLog, prop) => {
switch (prop) {
case 'add':
return (quad: Quad) => {
obj.add(quad);
Function buildProject
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static buildProject(directory: string, options: ProjectBuildOptions = {}): Promise<number> {
return new Promise((resolve, reject) => {
// Prepare directories
if (fs.existsSync(directory)) {
fs.rmSync(directory, { recursive: true });
Function deserializePredicates
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function deserializePredicates(predicates: any) {
return Object.keys(predicates)
.map((predicate: any) => {
return {
[predicate]: predicates[predicate].map((item: any) => {
Function serializer
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
serializer: (node: Node<any, any>, baseUri: IriString) => {
if (!(node instanceof ProcessingNode)) {
return undefined;
}