Showing 56 of 138 total issues
Function showWidget
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
, showWidget: function(e) {
e.stopPropagation();
e.preventDefault();
if (this.open) {
Function dateUpdated
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
dateUpdated: function(e){
// `this.updating` is a workaround for preventing infinite recursion
// between `changeDate` triggering and `setUTCDate` calling. Until
// there is a better mechanism.
if (this.updating)
Function getElements
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Dropzone.getElements = function(els, name) {
var e, el, elements, _i, _j, _len, _len1, _ref;
if (els instanceof Array) {
elements = [];
try {
Avoid deeply nested control flow statements. Open
if (this.o.minViewMode === 1){
this._setDate(UTCDate(year, month, day));
this.showMode();
} else {
this.showMode(-1);
Method create
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create
merge_params
@resource_instance = @model.new(send(whitelisted_params))
respond_to do |format|
if @resource_instance.save
- 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
Method collection_check_boxes
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def collection_check_boxes(method, collection, value_method, text_method, options = {}, html_options = {})
Avoid deeply nested control flow statements. Open
if (hours > 12) {
hours = hours - 12;
}
Avoid deeply nested control flow statements. Open
if (this.viewMode === 1)
this._trigger('changeYear', this.viewDate);
Avoid deeply nested control flow statements. Open
if (month === 0){
month = 11;
year -= 1;
}
else {
Avoid deeply nested control flow statements. Open
if (option.selected) {
formData.append(inputName, option.value);
}
Avoid deeply nested control flow statements. Open
if (this.o.minViewMode === 2){
this._setDate(UTCDate(year, month, day));
}
Avoid deeply nested control flow statements. Open
else if (target.hasClass('new')){
if (month === 11){
month = 0;
year += 1;
}
Consider simplifying this complex logical expression. Open
if (window.File && window.FileReader && window.FileList && window.Blob && window.FormData && document.querySelector) {
if (!("classList" in document.createElement("a"))) {
capableBrowser = false;
} else {
_ref = Dropzone.blacklistedBrowsers;
Avoid too many return
statements within this function. Open
return false;
Method google
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def google
authorize! :read, Adminpanel::Analytic
unless Adminpanel.analytics_profile_id.nil? || Adminpanel.analytics_key_filename.nil? || Adminpanel.analytics_account_email.nil?
service_account_email = Adminpanel.analytics_account_email # Email of service account
- 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
Method create
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create
user = User.find_by_email(params[:session][:email].downcase)
if user && user.authenticate(params[:session][:password])
sign_in user
flash[:success] = I18n.t('authentication.signin_success')
- 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"