CLOSER-Cohorts/archivist

View on GitHub

Showing 219 of 2,583 total issues

Avoid too many return statements within this function.
Open

  return (
    <Button variant='outlined'>
      <Link to={to}>{label}</Link>
    </Button>    
  );
Severity: Major
Found in react/src/components/AuthButton.js - About 30 mins to fix

Function UserForm has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const UserForm = (props) => {
  const {user, onChange, path, onDelete} = props;

  const dispatch = useDispatch();
  const classes = useStyles();
Severity: Minor
Found in react/src/components/UserForm.js - About 25 mins to fix

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 QuestionItemListItem has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const QuestionItemListItem = (props) => {
  const {item, instrumentId} = props
  const classes = useStyles();

  const title = (isEmpty(item.question)) ? item.label : item.question.literal
Severity: Minor
Found in react/src/pages/InstrumentMap.js - About 25 mins to fix

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 AdminUserForm has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const AdminUserForm = (props) => {
  const {user} = props;

  const dispatch = useDispatch();
  const classes = useStyles();
Severity: Minor
Found in react/src/components/AdminUserForm.js - About 25 mins to fix

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 SequenceTopicsFinder has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const SequenceTopicsFinder = (props) => {
  const dispatch = useDispatch()
  const { instrumentId, sequence } = props
  const questions = useSelector(state => state.cc_questions);
  const cc_questions = get(questions, instrumentId, {})
Severity: Minor
Found in react/src/pages/InstrumentMap.js - About 25 mins to fix

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 TopicList has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const TopicList = (props) => {
  const dispatch = useDispatch()
  const {topicId, instrumentId, ccQuestionId=undefined} = props
  const { handleChange=(event, value, reason) => {
    dispatch(CcQuestions.topic.set(instrumentId, ccQuestionId, (reason === 'clear') ? null : value.id));
Severity: Minor
Found in react/src/pages/InstrumentMap.js - About 25 mins to fix

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 LoopItem has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const LoopItem = (props) => {
  const {type, id, instrumentId, title} = props
  const classes = useStyles();
  const [open, setOpen] = React.useState(true);

Severity: Minor
Found in react/src/pages/InstrumentView.js - About 25 mins to fix

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 TopicList has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const TopicList = (props) => {
  const {topicId, datasetId, variableId} = props

  const dispatch = useDispatch()

Severity: Minor
Found in react/src/pages/DatasetView.js - About 25 mins to fix

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 InstrumentConstructBuild has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const InstrumentConstructBuild = (props) => {

  const classes = useStyles();

  const dispatch = useDispatch()
Severity: Minor
Found in react/src/pages/InstrumentConstructBuild.js - About 25 mins to fix

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 IntervieweeList has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const IntervieweeList = ({ instrumentId }) => {
  const dispatch = useDispatch();
  const allResponseUnits = useSelector(state => state.response_units);
  const responseUnits = get(allResponseUnits, instrumentId, {});
  const [dataLoaded, setDataLoaded] = useState(false);
Severity: Minor
Found in react/src/pages/InstrumentCcQuestions.js - About 25 mins to fix

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 LoopItem has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const LoopItem = (props) => {
  const { type, id, instrumentId, title } = props
  const classes = useStyles();
  const [open, setOpen] = React.useState(true);

Severity: Minor
Found in react/src/pages/InstrumentMap.js - About 25 mins to fix

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 AuthRoute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const AuthRoute = props => {

  const isAuthUser = useSelector(state => state.auth.isAuthUser);
  const user = useSelector(state => get(state.auth, 'user'));

Severity: Minor
Found in react/src/AuthRoute.js - About 25 mins to fix

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 DataTable has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const DataTable = (props) => {

  const { actions=()=>{}, fetch=[], stateKey='instruments', searchKey='prefix', headers=[], rowRenderer=()=>{}, parentStateKey, sortKeys=[] } = props;
  let { searchKeys = [searchKey], filters = [] } = props;

Severity: Minor
Found in react/src/components/DataTable.js - About 25 mins to fix

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 clear_cache has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def clear_cache
      @updates.each do | u |
        id = u[:id]
        parent_id = u[:parent][:id]
        parent_type = db_type(u[:parent][:type])
Severity: Minor
Found in app/services/instruments/control_construct_updater.rb - About 25 mins to fix

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 add_sources has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def add_sources
    head :bad_request if params[:sources].nil?

    params[:sources] = JSON.parse(params[:sources]) if params[:sources].is_a?(String)

Severity: Minor
Found in app/controllers/variables_controller.rb - About 25 mins to fix

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_question_items has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def create_question_items(question_items=[])
      question_items.each do | question_item_hash |
        urn = question_item_hash.fetch(:urn, '')
        parsed_urn = parse_urn(urn)

Severity: Minor
Found in lib/importers/xml/ddi/fragment_instance.rb - About 25 mins to fix

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 XML_node has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def XML_node(node)
      if node.name == 'QuestionItem'
        question = question_item_node node
      elsif node.name == 'QuestionGrid'
        question = question_grid_node node
Severity: Minor
Found in lib/importers/xml/ddi/question.rb - About 25 mins to fix

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
    if params[:fragment_xml]
      fragment_instance = Importers::XML::DDI::FragmentInstance.new(params[:fragment_xml], @instrument)
      fragment_instance.process
      if fragment_instance.valid?
Severity: Minor
Found in app/controllers/question_controller.rb - About 25 mins to fix

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 set_import_to_finished has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def set_import_to_finished
      return unless @import
      @import.update(state: (@errors) ? :failure : :success, log: @logs.to_json)
    end
Severity: Minor
Found in lib/importers/loggable.rb - About 25 mins to fix

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

Severity
Category
Status
Source
Language