Showing 277 of 350 total issues
Function extend
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
jQuery.extend = jQuery.fn.extend = function() {
var options, name, src, copy, copyIsArray, clone,
target = arguments[0] || {},
i = 1,
length = arguments.length,
Function step
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
step: function( gotoEnd ) {
var t = jQuery.now(), done = true;
if ( gotoEnd || t >= this.options.duration + this.startTime ) {
this.now = this.end;
Method get_formatted_value
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def get_formatted_value(field_description)
value = get_value(field_description)
# Apply format
data_format = field_description.data_format
if data_format
Method parse_price2
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
def parse_price2(price_element)
price_hash = {}
price_elements = price_element.xpath(".//span[@class='hodnota']")
if price_elements.size == 1
price_hash[:price] = parse_float(price_elements[0].inner_text.strip)
- 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 parse_price1
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
def parse_price1(price_element)
price_hash = {}
if price_element.xpath(".//span").size == 1
price_hash[:price] = parse_float(price_element.xpath(".//span[1]").inner_text.strip)
price_hash[:price_interval] = false
- 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
Function hashchangeLoader
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
hashchangeLoader: function () {
var History = $.History;
// More is needed for non IE8 browsers
if ( !($.browser.msie && parseInt($.browser.version) >= 8) ) {
Function data
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
data: function( key, value ) {
var data = null;
if ( typeof key === "undefined" ) {
if ( this.length ) {
Method parse_price2
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def parse_price2(price_element)
price_hash = {}
price_elements = price_element.xpath(".//span[@class='hodnota']")
if price_elements.size == 1
price_hash[:price] = parse_float(price_elements[0].inner_text.strip)
Method perform
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def perform
document_ids = {
notice: [],
performance: []
}
Method parse_price1
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def parse_price1(price_element)
price_hash = {}
if price_element.xpath(".//span").size == 1
price_hash[:price] = parse_float(price_element.xpath(".//span[1]").inner_text.strip)
price_hash[:price_interval] = false
Function addListItem
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function addListItem(optionId) {
// add a new item to the html list
var $O = $('#' + optionId);
Method digest
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def digest(doc)
lawyer_table = doc.xpath("//div[@class='section']/table[@class='filter']").first
original_name = lawyer_table.xpath('./tr[1]/td[2]').inner_text.strip
name_ary = original_name.split
Method update_source_url_and_document_id
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def self.update_source_url_and_document_id(sta_procurement, all_bulletins)
key = "#{sta_procurement.bulletin_id}/#{sta_procurement.year}"
url = all_bulletins[key]
document = Nokogiri::HTML(Typhoeus::Request.get(url).body)
Function fix
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
fix: function( event ) {
if ( event[ jQuery.expando ] ) {
return event;
}
Consider simplifying this complex logical expression. Open
Open
if ( match[1] === "nth" ) {
// parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
!/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
Function toArray
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
toArray: function(o) {
o = o || {};
var sDepth = o.startDepthCount || 0;
var ret = [];
Method digest
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def digest(doc)
ico = name = place = date_start = date_end = address = region = ''
trs = doc.css(".detailTable tr.detailTableRow")
Method parse
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def self.parse(html, year)
::Parsers::Support.save(parse_location(year), 'csv', bucketize: false)
CSV.open(::Parsers::Support.get_path(parse_location(year), bucketize: false), "wb", force_quotes: true) do |csv|
csv << ATTRIBUTES
Function positionTooltip
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var positionTooltip = function(e){
var posx = 0;
var posy = 0;
if (!e) var e = window.event;
Method update
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def update
@dataset_description = DatasetDescription.find_by_id(params[:id])
@dataset_class = @dataset_description.dataset_model
if params[:record].blank?