cattr-app/server-application

View on GitHub

Showing 84 of 177 total issues

Function fieldsProvider has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function fieldsProvider() {
    return [
        {
            key: 'id',
            displayable: () => false,
Severity: Major
Found in resources/frontend/core/modules/Users/sections/account.js - About 2 hrs to fix

    Function render has 56 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                        render(h, props) {
                            const defaultConfig = [
                                {
                                    start: 0,
                                    end: 0.75,
    Severity: Major
    Found in resources/frontend/core/modules/Settings/sections/general.js - About 2 hrs to fix

      Method tasks has 55 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function tasks(IntervalTasksRequest $request): JsonResponse
          {
              $requestData = Filter::process(Filter::getRequestFilterName(), $request->validated());
      
              $timezone = Settings::scope('core')->get('timezone', 'UTC');
      Severity: Major
      Found in app/Http/Controllers/Api/IntervalController.php - About 2 hrs to fix

        Method handle has 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function handle(Client $client): int
            {
                if (Settings::scope('core')->get('instance')) {
                    echo 'Application already registered';
                    return 1;
        Severity: Major
        Found in app/Console/Commands/RegisterInstance.php - About 2 hrs to fix

          File IntervalController.php has 253 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          namespace App\Http\Controllers\Api;
          
          use App\Contracts\ScreenshotService;
          Severity: Minor
          Found in app/Http/Controllers/Api/IntervalController.php - About 2 hrs to fix

            Function render has 49 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                        render: (h, props) => {
                            return h(VueEditor, {
                                props: {
                                    useMarkdownShortcuts: true,
                                    editorToolbar: [
            Severity: Minor
            Found in resources/frontend/core/modules/Tasks/module.init.js - About 1 hr to fix

              Method up has 49 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function up()
                  {
                      $user_role_id = 2;
                      $manager_role_id = 5;
                      $blocked_role_id = 255;
              Severity: Minor
              Found in database/migrations/2018_09_27_100017_update_rules.php - About 1 hr to fix

                Function fieldsToFillProvider has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                export function fieldsToFillProvider() {
                    return [
                        {
                            key: 'id',
                            displayable: () => false,
                Severity: Minor
                Found in resources/frontend/core/modules/Users/sections/users.js - About 1 hr to fix

                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

                Method edit has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function edit(EditTaskRequest $request): JsonResponse
                    {
                        Filter::listen(
                            Filter::getRequestFilterName(),
                            static function (array $requestData) {
                Severity: Minor
                Found in app/Http/Controllers/Api/TaskController.php - About 1 hr to fix

                  Function timePerProject has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      timePerProject: (state, getters) => {
                          return Object.keys(getters.intervals).reduce((result, userID) => {
                              const userEvents = getters.intervals[userID];
                              if (!userEvents) {
                                  return result;
                  Severity: Minor
                  Found in resources/frontend/core/modules/Dashboard/storeModule.js - About 1 hr to fix

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

                                render: (h, props) => {
                                    const data = [];
                                    Object.keys(props.currentValue).forEach(k => {
                                        props.currentValue[k].time = formatDurationString(+props.currentValue[k].duration);
                                        data.push(props.currentValue[k]);
                    Severity: Minor
                    Found in resources/frontend/core/modules/Tasks/module.init.js - About 1 hr to fix

                      Method up has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function up()
                          {
                              DB::unprepared('
                                  CREATE OR REPLACE VIEW `project_report` AS
                                  SELECT
                      Severity: Minor
                      Found in database/migrations/2019_09_24_054346_fix_project_report_view.php - About 1 hr to fix

                        Method up has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function up()
                            {
                                DB::unprepared('
                                    CREATE OR REPLACE VIEW `project_report` AS
                                    SELECT
                        Severity: Minor
                        Found in database/migrations/2019_12_20_073840_fix_project_report.php - About 1 hr to fix

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

                              public function handle(): int
                              {
                                  if ($this->option('email')) {
                                      $email = $this->option('email');
                          
                          
                          Severity: Minor
                          Found in app/Console/Commands/MakeAdmin.php - About 1 hr to fix

                          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 handle has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function handle(Client $client): int
                              {
                                  if (Settings::scope('core')->get('instance')) {
                                      echo 'Application already registered';
                                      return 1;
                          Severity: Minor
                          Found in app/Console/Commands/RegisterInstance.php - About 1 hr to fix

                          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 exports has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          module.exports = () => {
                              console.log('Reading modules config file...');
                              const p = path.join(__dirname, '..', 'etc', 'modules.config.json');
                          
                              if (!fs.existsSync(path.join(__dirname, '..', 'generated'))) {
                          Severity: Minor
                          Found in resources/frontend/compiler/index.js - About 1 hr to fix

                            Method process has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function process(Request $request): JsonResponse
                                {
                                    $validator = Validator::make($request->all(), [
                                        'email' => 'required|email',
                                        'token' => 'required|string',
                            Severity: Minor
                            Found in app/Http/Controllers/PasswordResetController.php - About 1 hr to fix

                              Method up has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function up()
                                  {
                                      DB::unprepared('
                                          CREATE OR REPLACE VIEW `project_report` AS
                                          SELECT
                              Severity: Minor
                              Found in database/migrations/2018_10_01_134048_add_project_report_view.php - About 1 hr to fix

                                Method updateProjectSource has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    protected function updateProjectSource()
                                    {
                                        $projectIds = DB::table(Property::getTableName())
                                            ->select('entity_id')
                                            ->where('entity_type', '=', Property::PROJECT_CODE)
                                Severity: Minor
                                Found in database/migrations/2020_03_24_064952_add_project_source.php - About 1 hr to fix

                                  Method total has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public function total(Request $request): JsonResponse
                                      {
                                          $validationRules = [
                                              'start_at' => 'required|date',
                                              'end_at' => 'required|date',
                                  Severity: Minor
                                  Found in app/Http/Controllers/Api/TimeController.php - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language