SU-SWS/stanford_profile_helper

View on GitHub

Showing 397 of 590 total issues

Identical blocks of code found in 11 locations. Consider refactoring.
Open

const config = {
  isProd: process.env.NODE_ENV === "production",
  hmrEnabled: process.env.NODE_ENV !== "production" && !process.env.NO_HMR,
  distFolder: path.resolve(__dirname, "./dist/css"),
  wdsPort: 3001,
Severity: Major
Found in modules/stanford_courses/webpack.config.js and 10 other locations - About 1 hr to fix
modules/stanford_basic_page_types/webpack.config.js on lines 11..16
modules/jumpstart_ui/webpack.config.js on lines 11..16
modules/stanford_events/webpack.config.js on lines 12..17
modules/stanford_intranet/webpack.config.js on lines 11..16
modules/stanford_layout_paragraphs/webpack.config.js on lines 11..16
modules/stanford_news/webpack.config.js on lines 11..16
modules/stanford_notifications/webpack.config.js on lines 11..16
modules/stanford_person/webpack.config.js on lines 11..16
modules/stanford_profile_styles/webpack.config.js on lines 11..16
modules/stanford_publication/webpack.config.js on lines 11..16

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 75.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 11 locations. Consider refactoring.
Open

const config = {
  isProd: process.env.NODE_ENV === "production",
  hmrEnabled: process.env.NODE_ENV !== "production" && !process.env.NO_HMR,
  distFolder: path.resolve(__dirname, "./dist/css"),
  wdsPort: 3001,
Severity: Major
Found in modules/stanford_intranet/webpack.config.js and 10 other locations - About 1 hr to fix
modules/stanford_basic_page_types/webpack.config.js on lines 11..16
modules/jumpstart_ui/webpack.config.js on lines 11..16
modules/stanford_courses/webpack.config.js on lines 11..16
modules/stanford_events/webpack.config.js on lines 12..17
modules/stanford_layout_paragraphs/webpack.config.js on lines 11..16
modules/stanford_news/webpack.config.js on lines 11..16
modules/stanford_notifications/webpack.config.js on lines 11..16
modules/stanford_person/webpack.config.js on lines 11..16
modules/stanford_profile_styles/webpack.config.js on lines 11..16
modules/stanford_publication/webpack.config.js on lines 11..16

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 75.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 11 locations. Consider refactoring.
Open

const config = {
  isProd: process.env.NODE_ENV === "production",
  hmrEnabled: process.env.NODE_ENV !== "production" && !process.env.NO_HMR,
  distFolder: path.resolve(__dirname, "./dist/css"),
  wdsPort: 3001,
Severity: Major
Found in modules/stanford_events/webpack.config.js and 10 other locations - About 1 hr to fix
modules/stanford_basic_page_types/webpack.config.js on lines 11..16
modules/jumpstart_ui/webpack.config.js on lines 11..16
modules/stanford_courses/webpack.config.js on lines 11..16
modules/stanford_intranet/webpack.config.js on lines 11..16
modules/stanford_layout_paragraphs/webpack.config.js on lines 11..16
modules/stanford_news/webpack.config.js on lines 11..16
modules/stanford_notifications/webpack.config.js on lines 11..16
modules/stanford_person/webpack.config.js on lines 11..16
modules/stanford_profile_styles/webpack.config.js on lines 11..16
modules/stanford_publication/webpack.config.js on lines 11..16

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 75.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 11 locations. Consider refactoring.
Open

const config = {
  isProd: process.env.NODE_ENV === "production",
  hmrEnabled: process.env.NODE_ENV !== "production" && !process.env.NO_HMR,
  distFolder: path.resolve(__dirname, "./dist/css"),
  wdsPort: 3001,
Severity: Major
Found in modules/stanford_news/webpack.config.js and 10 other locations - About 1 hr to fix
modules/stanford_basic_page_types/webpack.config.js on lines 11..16
modules/jumpstart_ui/webpack.config.js on lines 11..16
modules/stanford_courses/webpack.config.js on lines 11..16
modules/stanford_events/webpack.config.js on lines 12..17
modules/stanford_intranet/webpack.config.js on lines 11..16
modules/stanford_layout_paragraphs/webpack.config.js on lines 11..16
modules/stanford_notifications/webpack.config.js on lines 11..16
modules/stanford_person/webpack.config.js on lines 11..16
modules/stanford_profile_styles/webpack.config.js on lines 11..16
modules/stanford_publication/webpack.config.js on lines 11..16

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 75.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 11 locations. Consider refactoring.
Open

const config = {
  isProd: process.env.NODE_ENV === "production",
  hmrEnabled: process.env.NODE_ENV !== "production" && !process.env.NO_HMR,
  distFolder: path.resolve(__dirname, "./dist/css"),
  wdsPort: 3001,
Severity: Major
Found in modules/jumpstart_ui/webpack.config.js and 10 other locations - About 1 hr to fix
modules/stanford_basic_page_types/webpack.config.js on lines 11..16
modules/stanford_courses/webpack.config.js on lines 11..16
modules/stanford_events/webpack.config.js on lines 12..17
modules/stanford_intranet/webpack.config.js on lines 11..16
modules/stanford_layout_paragraphs/webpack.config.js on lines 11..16
modules/stanford_news/webpack.config.js on lines 11..16
modules/stanford_notifications/webpack.config.js on lines 11..16
modules/stanford_person/webpack.config.js on lines 11..16
modules/stanford_profile_styles/webpack.config.js on lines 11..16
modules/stanford_publication/webpack.config.js on lines 11..16

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 75.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Avoid excessively long variable names like $field_type_definition. Keep variable name length under 20.
Open

      $field_type_definition = $this->fieldTypeManager->getDefinition($field_type);

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $stanford_profile_helper_403_page. Keep variable name length under 20.
Open

  $stanford_profile_helper_403_page = \Drupal::config('system.site')
Severity: Minor
Found in stanford_profile_helper.module by phpmd

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $rabbitHolePluginManager. Keep variable name length under 20.
Open

  public function __construct(BehaviorInvokerInterface $rabbitHoleBehavior, RabbitHoleBehaviorPluginManager $rabbitHolePluginManager) {

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $stream_wrapper_manager. Keep variable name length under 20.
Open

  public function __construct(StateInterface $state, ConfigPagesLoaderServiceInterface $config_pages_loader, ConfigFactoryInterface $config_factory, EntityTypeManagerInterface $entity_type_manager, StreamWrapperManagerInterface $stream_wrapper_manager) {
Severity: Minor
Found in src/Config/ConfigOverrides.php by phpmd

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $rabbitHolePluginManager. Keep variable name length under 20.
Open

  protected $rabbitHolePluginManager;

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $stanford_default_content. Keep variable name length under 20.
Open

  public function __construct(StanfordDefaultContentInterface $stanford_default_content, StateInterface $state, EntityTypeManagerInterface $entity_type_manager) {

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Similar blocks of code found in 3 locations. Consider refactoring.
Open

  public function __construct(EntityTypeManagerInterface $entity_type_manager, FileRepositoryInterface $file_repository, FileSystemInterface $file_system, StateInterface $state, FileUsageInterface $file_usage) {
    $this->entityTypeManager = $entity_type_manager;
    $this->fileRepository = $file_repository;
    $this->fileSystem = $file_system;
    $this->state = $state;
Severity: Major
Found in modules/stanford_intranet/src/StanfordIntranetManager.php and 2 other locations - About 1 hr to fix
modules/stanford_intranet/src/Commands/IntranetCommands.php on lines 67..73
src/Config/ConfigOverrides.php on lines 70..76

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 84.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Method stanford_person_importer_post_update_8002 has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function stanford_person_importer_post_update_8002(&$sandbox) {
  if (!\Drupal::database()
    ->schema()
    ->tableExists('migrate_map_su_stanford_person')) {
    return;

    Method baseFieldDefinitions has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
        $fields = parent::baseFieldDefinitions($entity_type);
    
        $fields['title'] = BaseFieldDefinition::create('string')
          ->setLabel(t('Title'))
    Severity: Minor
    Found in modules/stanford_publication/src/Entity/Citation.php - About 1 hr to fix

      Method preSaveNode has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        protected function preSaveNode(NodeInterface $entity): void {
          // Invalidate any search result cached so the updated/new content will be
          // displayed for previously searched terms.
          Cache::invalidateTags(['config:views.view.search']);
      
      
      Severity: Minor
      Found in src/EventSubscriber/EntityEventSubscriber.php - About 1 hr to fix

        Method createParagraph has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          protected function createParagraph($bundle): EntityInterface {
            // We've already created this paragraph type, just duplicated i.
            if (isset($this->paragraphs[$bundle])) {
              return $this->paragraphs[$bundle]->createDuplicate();
            }

          Function getEvents has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            async function getEvents(url, startDate, endDate) {
              const filters = {status: 1};
              if (startDate !== undefined) {
                filters.startDate = {
                  condition: {
          Severity: Minor
          Found in modules/stanford_events/pdb_components/mini-calendar/src/index.js - About 1 hr to fix

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

              public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
                $form = parent::buildConfigurationForm($form, $form_state);
            
                // Extra CSS classes.
                $form['extra_classes'] = [
            Severity: Minor
            Found in modules/jumpstart_ui/src/Layouts/JumpstartUiLayouts.php - About 1 hr to fix

              Function attach has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  attach: function attach(context, settings) {
              
                    if (settings?.stanfordNews?.hideSocial) {
                      return;
                    }
              Severity: Minor
              Found in modules/stanford_news/lib/js/news-node.js - About 1 hr to fix

                Method toolbar has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  public function toolbar() {
                    $notification_list = $this->getToolbarTrayItems($this->getUserNotifications());
                
                    $items['notifications'] = [
                      '#type' => 'toolbar_item',
                Severity: Minor
                Found in modules/stanford_notifications/src/NotificationService.php - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language