Skip to content
Snippets Groups Projects
Select Git revision
  • 479c0147bedb57cca8d670e92387fa806fe5dbfc
  • master default protected
2 results

Rakefile

Blame
    • Imran Iqbal's avatar
      ead2d21b
      fix(rubocop): fix (or exclude) all violations · ead2d21b
      Imran Iqbal authored
      ```bash
      tomcat-formula$ rubocop -d
      
      Offenses:
      
      Rakefile:1:1: C: Style/FrozenStringLiteralComment: Missing frozen string literal comment.
      require 'rake'
      ^
      Rakefile:31:4: C: Layout/TrailingEmptyLines: Final newline missing.
      end
      
      test/integration/tomcat_extend/serverspec/tomcat_extend_spec.rb:791:1: E: Lint/Syntax: unexpected token $end
      (Using Ruby 2.7 parser; configure using TargetRubyVersion parameter, under AllCops)
      test/integration/tomcat_install/controls/yaml_dump_spec.rb:175:79: C: Style/FormatStringToken: Prefer annotated tokens (like %<foo>s) over template tokens (like %{foo}).
                    pattern: '%h %l %u %t &quot;%m http://%v%U %H&quot; %s %b &quot;%{Referer}i&quot;
                                                                                    ^^^^^^^^^^
      test/integration/tomcat_install/controls/yaml_dump_spec.rb:348:79: C: Style/FormatStringToken: Prefer annotated tokens (like %<foo>s) over template tokens (like %{foo}).
                    pattern: '%h %l %u %t &quot;%m http://%v%U %H&quot; %s %b &quot;%{Referer}i&quot;
                                                                                    ^^^^^^^^^^
      test/integration/tomcat_install/controls/yaml_dump_spec.rb:521:79: C: Style/FormatStringToken: Prefer annotated tokens (like %<foo>s) over template tokens (like %{foo}).
                    pattern: '%h %l %u %t &quot;%m http://%v%U %H&quot; %s %b &quot;%{Referer}i&quot;
                                                                                    ^^^^^^^^^^
      test/integration/tomcat_install/serverspec/install_spec.rb:11:20: E: Lint/Syntax: unexpected token tCOLON
      (Using Ruby 2.7 parser; configure using TargetRubyVersion parameter, under AllCops)
          service_running: False
                         ^
      test/integration/tomcat_install/serverspec/install_spec.rb:19:20: E: Lint/Syntax: unexpected token tCOLON
      (Using Ruby 2.7 parser; configure using TargetRubyVersion parameter, under AllCops)
          service_running: False
                         ^
      test/integration/tomcat_install/serverspec/install_spec.rb:26:20: E: Lint/Syntax: unexpected token tCOLON
      (Using Ruby 2.7 parser; configure using TargetRubyVersion parameter, under AllCops)
          service_running: False
                         ^
      test/integration/tomcat_install/serverspec/install_spec.rb:35:22: E: Lint/Syntax: unexpected token tCOLON
      (Using Ruby 2.7 parser; configure using TargetRubyVersion parameter, under AllCops)
            service_running: False
                           ^
      test/integration/tomcat_install/serverspec/install_spec.rb:42:22: E: Lint/Syntax: unexpected token tCOLON
      (Using Ruby 2.7 parser; configure using TargetRubyVersion parameter, under AllCops)
            service_running: False
                           ^
      test/integration/tomcat_install/serverspec/install_spec.rb:49:22: E: Lint/Syntax: unexpected token tCOLON
      (Using Ruby 2.7 parser; configure using TargetRubyVersion parameter, under AllCops)
            service_running: False
                           ^
      test/integration/tomcat_install/serverspec/install_spec.rb:77:1: E: Lint/Syntax: unexpected token kEND
      (Using Ruby 2.7 parser; configure using TargetRubyVersion parameter, under AllCops)
      end
      ^^^
      test/integration/tomcat_install/serverspec/install_spec.rb:187:5: E: Lint/Syntax: unexpected token kWHEN
      (Using Ruby 2.7 parser; configure using TargetRubyVersion parameter, under AllCops)
          when '18.04'
          ^^^^
      test/shared/spec_helper.rb:1:1: C: Style/FrozenStringLiteralComment: Missing frozen string literal comment.
      require "serverspec"
      ^
      test/shared/spec_helper.rb:1:9: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
      require "serverspec"
              ^^^^^^^^^^^^
      test/shared/spec_helper.rb:2:9: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
      require "pathname"
              ^^^^^^^^^^
      test/shared/spec_helper.rb:8:12: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
        c.path = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      
      9 files inspected, 18 offenses detected
      ```
      fix(rubocop): fix (or exclude) all violations
      Imran Iqbal authored
      ```bash
      tomcat-formula$ rubocop -d
      
      Offenses:
      
      Rakefile:1:1: C: Style/FrozenStringLiteralComment: Missing frozen string literal comment.
      require 'rake'
      ^
      Rakefile:31:4: C: Layout/TrailingEmptyLines: Final newline missing.
      end
      
      test/integration/tomcat_extend/serverspec/tomcat_extend_spec.rb:791:1: E: Lint/Syntax: unexpected token $end
      (Using Ruby 2.7 parser; configure using TargetRubyVersion parameter, under AllCops)
      test/integration/tomcat_install/controls/yaml_dump_spec.rb:175:79: C: Style/FormatStringToken: Prefer annotated tokens (like %<foo>s) over template tokens (like %{foo}).
                    pattern: '%h %l %u %t &quot;%m http://%v%U %H&quot; %s %b &quot;%{Referer}i&quot;
                                                                                    ^^^^^^^^^^
      test/integration/tomcat_install/controls/yaml_dump_spec.rb:348:79: C: Style/FormatStringToken: Prefer annotated tokens (like %<foo>s) over template tokens (like %{foo}).
                    pattern: '%h %l %u %t &quot;%m http://%v%U %H&quot; %s %b &quot;%{Referer}i&quot;
                                                                                    ^^^^^^^^^^
      test/integration/tomcat_install/controls/yaml_dump_spec.rb:521:79: C: Style/FormatStringToken: Prefer annotated tokens (like %<foo>s) over template tokens (like %{foo}).
                    pattern: '%h %l %u %t &quot;%m http://%v%U %H&quot; %s %b &quot;%{Referer}i&quot;
                                                                                    ^^^^^^^^^^
      test/integration/tomcat_install/serverspec/install_spec.rb:11:20: E: Lint/Syntax: unexpected token tCOLON
      (Using Ruby 2.7 parser; configure using TargetRubyVersion parameter, under AllCops)
          service_running: False
                         ^
      test/integration/tomcat_install/serverspec/install_spec.rb:19:20: E: Lint/Syntax: unexpected token tCOLON
      (Using Ruby 2.7 parser; configure using TargetRubyVersion parameter, under AllCops)
          service_running: False
                         ^
      test/integration/tomcat_install/serverspec/install_spec.rb:26:20: E: Lint/Syntax: unexpected token tCOLON
      (Using Ruby 2.7 parser; configure using TargetRubyVersion parameter, under AllCops)
          service_running: False
                         ^
      test/integration/tomcat_install/serverspec/install_spec.rb:35:22: E: Lint/Syntax: unexpected token tCOLON
      (Using Ruby 2.7 parser; configure using TargetRubyVersion parameter, under AllCops)
            service_running: False
                           ^
      test/integration/tomcat_install/serverspec/install_spec.rb:42:22: E: Lint/Syntax: unexpected token tCOLON
      (Using Ruby 2.7 parser; configure using TargetRubyVersion parameter, under AllCops)
            service_running: False
                           ^
      test/integration/tomcat_install/serverspec/install_spec.rb:49:22: E: Lint/Syntax: unexpected token tCOLON
      (Using Ruby 2.7 parser; configure using TargetRubyVersion parameter, under AllCops)
            service_running: False
                           ^
      test/integration/tomcat_install/serverspec/install_spec.rb:77:1: E: Lint/Syntax: unexpected token kEND
      (Using Ruby 2.7 parser; configure using TargetRubyVersion parameter, under AllCops)
      end
      ^^^
      test/integration/tomcat_install/serverspec/install_spec.rb:187:5: E: Lint/Syntax: unexpected token kWHEN
      (Using Ruby 2.7 parser; configure using TargetRubyVersion parameter, under AllCops)
          when '18.04'
          ^^^^
      test/shared/spec_helper.rb:1:1: C: Style/FrozenStringLiteralComment: Missing frozen string literal comment.
      require "serverspec"
      ^
      test/shared/spec_helper.rb:1:9: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
      require "serverspec"
              ^^^^^^^^^^^^
      test/shared/spec_helper.rb:2:9: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
      require "pathname"
              ^^^^^^^^^^
      test/shared/spec_helper.rb:8:12: C: Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
        c.path = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      
      9 files inspected, 18 offenses detected
      ```
    columns2.php 3.99 KiB
    <?php
    // This file is part of Moodle - http://moodle.org/
    //
    // Moodle is free software: you can redistribute it and/or modify
    // it under the terms of the GNU General Public License as published by
    // the Free Software Foundation, either version 3 of the License, or
    // (at your option) any later version.
    //
    // Moodle is distributed in the hope that it will be useful,
    // but WITHOUT ANY WARRANTY; without even the implied warranty of
    // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    // GNU General Public License for more details.
    //
    // You should have received a copy of the GNU General Public License
    // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
    
    /**
     * Theme Boost Campus - Layout file.
     *
     * @package   theme_boost_campus
     * @copyright 2017 Kathrin Osswald, Ulm University kathrin.osswald@uni-ulm.de
     * @copyright based on code from theme_boost by Damyon Wiese
     * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
     */
    
    defined('MOODLE_INTERNAL') || die();
    // MODIFICATION START.
    global $PAGE;
    // MODIFICATION END.
    
    user_preference_allow_ajax_update('drawer-open-nav', PARAM_ALPHA);
    require_once($CFG->libdir . '/behat/lib.php');
    require_once($CFG->dirroot . '/theme/boost_campus/locallib.php');
    
    if (isloggedin()) {
        $navdraweropen = (get_user_preferences('drawer-open-nav', 'true') == 'true');
    } else {
        $navdraweropen = false;
    }
    $extraclasses = [];
    if ($navdraweropen) {
        $extraclasses[] = 'drawer-open-left';
    }
    $bodyattributes = $OUTPUT->body_attributes($extraclasses);
    $blockshtml = $OUTPUT->blocks('side-pre');
    $hasblocks = strpos($blockshtml, 'data-block=') !== false;
    $regionmainsettingsmenu = $OUTPUT->region_main_settings_menu();
    $catchshortcuts = array();
    $catchendkey = get_config('theme_boost_campus', 'catchendkey');
    if (isset($catchendkey) && $catchendkey == true) {
        $catchshortcuts[] = 'end';
    }
    $catchcmdarrowdown = get_config('theme_boost_campus', 'catchcmdarrowdown');
    if (isset($catchcmdarrowdown) && $catchcmdarrowdown == true) {
        $catchshortcuts[] = 'cmdarrowdown';
    }
    $catchctrlarrowdown = get_config('theme_boost_campus', 'catchctrlarrowdown');
    if (isset($catchctrlarrowdown) && $catchctrlarrowdown == true) {
        $catchshortcuts[] = 'ctrlarrowdown';
    }
    // MODIFICATION START.
    // If the setting 'showsettingsincourse' is enabled.
    if (get_config('theme_boost_campus', 'showsettingsincourse') == 'yes') {
        // Only search for the courseadmin node if we are within a course context.
        if ($PAGE->context->contextlevel == CONTEXT_COURSE) {
            // Get the course context menu.
            $node = $PAGE->settingsnav->find('courseadmin', navigation_node::TYPE_COURSE);
        }
    } else {
        $node = false;
    }
    // MODIFICATION END.
    
    $templatecontext = [
        'sitename' => format_string($SITE->shortname, true, ['context' => context_course::instance(SITEID), "escape" => false]),
        'output' => $OUTPUT,
        'sidepreblocks' => $blockshtml,
        'hasblocks' => $hasblocks,
        'bodyattributes' => $bodyattributes,
        'navdraweropen' => $navdraweropen,
        'regionmainsettingsmenu' => $regionmainsettingsmenu,
        'hasregionmainsettingsmenu' => !empty($regionmainsettingsmenu),
        // MODIFICATION START.
        'catchshortcuts' => json_encode($catchshortcuts),
        'node' => $node
        // MODIFICATION END.
    ];
    
    // MODIDFICATION START.
    // Use the returned value from theme_boost_campus_get_modified_flatnav_defaulthomepageontop as the template context.
    $templatecontext['flatnavigation'] = theme_boost_campus_process_flatnav($PAGE->flatnav);
    // Render colums2.mustache from boost_campus.
    echo $OUTPUT->render_from_template('theme_boost_campus/columns2', $templatecontext);
    // MODIFICATION END.
    /* ORIGINAL START.
    echo $OUTPUT->render_from_template('theme_boost/columns2', $templatecontext);
    ORIGINAL END. */
    
    // MODIFICATION START.
    // Add footer blocks and standard footer.
    require_once(dirname(__FILE__).'/includes/footer.php');
    // Add badgearea.
    require_once(dirname(__FILE__).'/includes/badgearea.php');
    // Add footnote.
    require_once(dirname(__FILE__).'/includes/footnote.php');
    // MODIFICATION END.