GithubHelp home page GithubHelp logo

sattlert2 / expertiza Goto Github PK

View Code? Open in Web Editor NEW

This project forked from expertiza/expertiza

0.0 0.0 0.0 69.22 MB

Expertiza is a web application through which students can submit and peer-review learning objects (articles, code, web sites, etc). The Expertiza project is supported by the National Science Foundation.

Home Page: http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation

License: MIT License

Ruby 69.70% JavaScript 5.01% CSS 2.00% HTML 22.90% Shell 0.24% CoffeeScript 0.02% Dockerfile 0.05% TSQL 0.10%

expertiza's People

Contributors

agalford avatar ajcpendyala avatar akofink avatar anudeepvrm avatar aravind-anantha avatar bhumikadhotre avatar charonmiller08 avatar djgutier avatar dkernicky avatar efg avatar ferryxo avatar hliu115288339 avatar jdpmk avatar joshio1 avatar kkushagra avatar lramach avatar mengcao avatar mgdelcar avatar nilbus avatar p31d3ng avatar pamo avatar rajanalwan avatar rikenshah avatar rmmaily avatar saratkavuru avatar vaibhavgumashta avatar vchawla3 avatar winbobob avatar xxxxavier avatar yangsong8 avatar

expertiza's Issues

Avoid block nesting (2)

Avoid more than 3 levels of block nesting.
Total of 2 issues.

invalid: No method have more then 3 block nesting.

RUBERIC: Cognitive Complexity

Method save_all_questions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
New
def save_all_questions
questionnaire_id = params[:id]
begin
if params[:save]
params[:question].each_pair do |k, v|
Severity: Minor
Found in app/controllers/questionnaires_controller.rb - About 45 mins to fix
Assignment Branch Condition size for save_all_questions is too high. [26.78/15]
Severity: Minor

wontfix: Although code is long and has two nested loops. No need to make changes.

File too long

File questionnaires_controller.rb has 468 lines of code (exceeds 250 allowed). Consider refactoring.
Total of 1 issue.

RUBERIC: create_questionnaire

There is a method called create_questionnaire used. Is it used? There are no immediately apparent calls to it. The name is wrong (should be just create, but there is another, different create method). If not, remove create_questionnaire and the tests that test it. [It is not used, but it assigns a creator ID (instructor of the class) whereas create does not.]

RUBERIC: assignment branch condition (2)

New
def save_all_questions
questionnaire_id = params[:id]
begin
if params[:save]
params[:question].each_pair do |k, v|
Severity: Minor
Found in app/controllers/questionnaires_controller.rb - About 45 mins to fix
Assignment Branch Condition size for save_all_questions is too high. [26.78/15]
Severity: Minor

Assignment Branch Condition size for copy is too high. [20.64/15]
New
def copy
begin
instructor_id = session[:user].instructor_id
@questionnaire = Questionnaire.copy_questionnaire_details(params, instructor_id)
p_folder = TreeFolder.find_by(name: @questionnaire.display_type)
Severity: Minor

RUBERIC: questionnaire_id parameter

Several methods have a questionnaire_id as a parameter. It’s not clear that it’s necessary, since it seems just to be params[:id] for the questionnaire in use.

WONT FIX NOTE: The questionnaire_id parameter is passed to multiple private methods, and is needed then. Therefore, it is most readable to set questionnaire_id = params[:id] immediately, to ultimately improve consistency throughout file.

Unsafe reflection method (4)

Unsafe reflection method [METHOD] with parameter value
Total of 4 issues.

  • 3 of 4 issues were non-existent
  • 4 issue was resolved in add_new_questions method

RUBERIC: hardwired variables

Like the weights referred to above, there are other values that are hardwired into the code, especially in add_new_questions. A 0–5 scale for rubric criteria should not be wired in, nor should min and max labels. These variables (alternatives, min_label, max_label) should be, and probably are, set somewhere in the UI. Textfield sizes are OK to default to the sizes given, but they should be defined constants, not literal values in an assignment statement.

RUBERIC: QuizQuestionnaire checks

There are three checks for whether a questionnaire is a QuizQuestionnaire. Testing the class of an object is always suspect, though in a controller, which has to control a whole hierarchy of objects, it is not necessarily wrong. However, they probably aren’t necessary.

  • One of the checks is in create_questionnaire. [method may be removed]

  • One of them deals with weights for a question, which is a kludge or hack, since managing weights should really be done in the model (superclass Questionnaire or subclass QuizQuestionnaire).

  • The third check has something to do with TreeNodes, which are Expertiza’s way of displaying objects (such as courses and assignments) that need to be shown in a hierarchy. It’s not clear what’s going on here, but I doubt that QuizQuestionnaire really has to be special.

Use guard clause (2)

Use a guard clause instead of wrapping the code inside a conditional expression.
Total of 2 issues.

RUBERIC: break up 'create'

The create method itself is 49 lines long. This is much too long to be viewable at a glance. Break it up into other methods whose names are clear enough to be self-documenting.

Do not use Time.now (1)

Do not use Time.now without zone. Use one of Time.zone.now, Time.current, Time.now.in_time_zone, Time.now.utc, Time.now.getlocal, Time.now.iso8601, Time.now.jisx0301, Time.now.rfc3339, Time.now.to_i, Time.now.to_f instead.

Total of 1 issue.

Unprotected mass assignment (3)

Unprotected mass assignment
Total of 3 issues.

Issue should be resolved with strong parameters and it seems 2 of the 3 issues are already solved this way.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.