Showing 42 of 102 total issues
Function DBRepository
has 127 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const DBRepository = (Entity, options = {}) => {
const DB = Entity.dao;
return {
Function Persistence
has 96 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Persistence = (Entity, user = {}, FactoryDBRepository = DFactoryDBRepository) => {
const DBRepository = FactoryDBRepository(Entity);
return {
Function PersistenceApp
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const PersistenceApp = (Entity, PersistenceServices = DPersistenceServices) => {
return {
find (req, res, next) {
Function ApplicationReport
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const ApplicationReport = (Entity, PersistenceServices = DPersistenceServices) => {
return {
create(req, res, next) {
_.defaults(req.body, Entity.defaults || {});
Function UploaderRepository
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const UploaderRepository = (folder) => {
factoryValid(
_.pick(process.env, ['AWS_S3_BUCKET_NAME', 'AWS_ACCESS_KEY_ID', 'AWS_SECRET_ACCESS_KEY']),
s3Valid
Function HTTPService
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
Open
const HTTPService = (url) => (header = {}) => {
Object.assign(header, {Authorization: privateToken.token}); // inject private token, used to autheticate on private services
const factoryRequest = (caller, path, args) => {
- 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 ApplicationConnection
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const ApplicationConnection = (Entity, PersistenceServices = DPersistenceServices) => {
const formatProvider = (label) => _.toLower(label).replace(/\s/g, "");
return {
Function AuthService
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const AuthService = (Entity) => {
const DBRepository = FactoryDBRepository(Entity);
return {
Function AccessServices
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const AccessServices = (Entity, user={}, FactoryDBRepository = DFactoryDBRepository) => {
const DBRepository = FactoryDBRepository(Entity);
return {
Function DepsServices
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const DepsServices = (Entity, field, FactoryDBRepository = DFactoryDBRepository, FactoryDBBatch = DFactoryDBBatch) => {
const DBRepository = FactoryDBRepository(Entity);
const DBBatch = FactoryDBBatch(Entity);
Function PersistenceGraph
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const PersistenceGraph = (Entity, PersistenceServices = DPersistenceServices) => {
return {
find(req, res, next) {
const field = 'query';
Function exports
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
Open
module.exports = function (query, field = 'query', rules = []) {
if (query.hasOwnProperty(field)) {
let omits = [];
for (let rule in rules) {
- 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 UploaderRepository
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const UploaderRepository = (folder) => {
const base_api = (host) => {
const url = process.env.API_URL || `//${host}`;
return url.replace(/\/$/, "");
};
Function Persistence
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Persistence = (Entity, FactoryDBRepository = DFactoryDBRepository) => {
const DBRepository = FactoryDBRepository(Entity);
return {
Function find
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Query.prototype.find = function (query, options) {
let Model = this.model;
query = _.assign({}, this.query, query);
Function connections
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const connections = function () {
const module = 'connections';
let template = null;
const populate = async function () {
Function WrapperPersistenceApp
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const WrapperPersistenceApp = (Entity) => (ACEntity) => (FactoryPesistenceApp = DFactoryPesistenceApp) => (apply) => {
const PesistenceApp = FactoryPesistenceApp(Entity);
const factoryWrapper = function(method, access) {
Function UsersPersistence
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const UsersPersistence = (Entity) => {
const DBRepository = FactoryDBRepository(Entity);
return Object.assign({}, Persistence(Entity), {
Function HTTPService
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const HTTPService = (url) => (header = {}) => {
Object.assign(header, {Authorization: privateToken.token}); // inject private token, used to autheticate on private services
const factoryRequest = (caller, path, args) => {
Function UploaderService
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const UploaderService = (Entity) => {
const typeU = process.env.MAESTRO_UPLOAD_TYPE || TYPE_DEFAULT;
const FUploaderRepository = require(`core/repositories/uploader${typeU}Repository`);
const UploaderRepository = FUploaderRepository(Entity.name);