hexlet-codebattle/codebattle

View on GitHub

Showing 200 of 693 total issues

Function SignatureForm has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

function SignatureForm({ signature, handleEdit }) {
  const types = useMemo(() => resolveSignatureToTypes(signature), [signature]);

  const handleSelect = useCallback((newType, nestedIndex) => {
    const newTypes = types.map((type, index) => (index === nestedIndex ? newType : type));

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

const TaskParamsModal = NiceModal.create(({
  taskService,
  mode: defaultMode = 'none',
  action = 'none',
}) => {

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 changePlaybookSolution has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const changePlaybookSolution = method => dispatch => {
  axios
    .post(
      `/api/v1/playbooks/${method}`,
      {
Severity: Minor
Found in services/app/apps/codebattle/assets/js/widgets/middlewares/Room.js - About 1 hr to fix

    Function Editor has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function Editor(props) {
      const {
        value,
        syntax,
        onChange,

      Function useEditorCursor has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const useEditorCursor = editor => {
        const handleChangeCursorSelection = useCallback(e => {
          const { readOnly, canSendCursor } = editor.getRawOptions();
      
          if (!canSendCursor) {

        Function collectFinalRecord has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const collectFinalRecord = (acc, strRecord) => {
          const record = parse(strRecord);
          const { players } = acc;
        
          let player;
        Severity: Minor
        Found in services/app/apps/codebattle/assets/js/widgets/lib/player.js - About 1 hr to fix

          Function isValidValueToSignature has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const isValidValueToSignature = (value, signature) => {
            if (!signature) {
              return false;
            }
          
          

            Function validateTaskName has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const validateTaskName = name => (dispatch, getState) => {
              if (name.length < MIN_NAME_LENGTH || name.length > MAX_NAME_LENGTH) {
                return;
              }
            
            
            Severity: Minor
            Found in services/app/apps/codebattle/assets/js/widgets/middlewares/Room.js - About 1 hr to fix

              Function useGameRoomSocketChannel has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const useGameRoomSocketChannel = (pageName, machines) => {
                const dispatch = useDispatch();
              
                const useChat = useSelector(selectors.gameUseChatSelector);
              
              

                Function useHover has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function useHover() {
                  const [hovering, setHovering] = useState(false);
                  const previousNode = useRef(null);
                
                  const handleMouseEnter = useCallback(() => {
                Severity: Minor
                Found in services/app/apps/codebattle/assets/js/widgets/utils/useHover.js - About 1 hr to fix

                  Function FeedbackWidget has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function FeedbackWidget() {
                    const dispatch = useDispatch();
                  
                    const currentUserName = useSelector(currentUserNameSelector);
                  
                  

                    Function ArenaInfoWidget has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const ArenaInfoWidget = () => {
                      const {
                        state,
                        taskCount,
                        taskSolvedCount,

                      Method call has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def self.call
                          original_stdout = $stdout
                          $stdout = StringIO.new
                          @execution_result = []
                          args_list = JSON.parse(File.read(File.join(__dir__, './check/asserts.json')))
                      Severity: Minor
                      Found in services/app/apps/runner/dockers/ruby/checker.rb - About 1 hr to fix

                        Function reduceOriginalRecords has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                        const reduceOriginalRecords = (acc, record, index) => {
                          const {
                            players, records, chat: chatState, type: playbookType,
                          } = acc;
                          const { messages, users } = chatState;
                        Severity: Minor
                        Found in services/app/apps/codebattle/assets/js/widgets/lib/player.js - About 1 hr 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 ArenaStageStatus has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function ArenaStageStatus({
                          playerId,
                          matchList,
                          matchState,
                        }) {

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

                        exports.run = function run(args = [], count) {
                          let output = '';
                          let oldConsole = console;
                        
                          const fakeStream = new Writable();
                        Severity: Minor
                        Found in services/app/apps/runner/dockers/js/assertsRunner.js - About 1 hr 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 call has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public static function call() {
                                global $execution_result;
                                $execution_result = [];
                        
                                $args_list = json_decode(file_get_contents(__DIR__ . '/check/asserts.json'), true);
                        Severity: Minor
                        Found in services/app/apps/runner/dockers/php/checker.php - About 1 hr to fix

                          Function solution has 8 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          func solution(a int64, b int64, c string, d float64, e bool, f map[string]string, g []string, h [][]string) int64 {
                          Severity: Major
                          Found in services/app/apps/runner/dockers/golang/check/solution.go - About 1 hr to fix

                            Method solution has 8 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                              public Integer solution(Integer a, Integer b, String c, Double d, Boolean e, Map<String, String> f, List<String> g,
                                  List<List<String>> h) {
                            Severity: Major
                            Found in services/app/apps/runner/dockers/java/check/Solution.java - About 1 hr to fix

                              Method solution has 8 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                              def solution(numerator, denominator, _string, _float, _bool, _hash, _list_str, _list_list_str)
                              Severity: Major
                              Found in services/app/apps/runner/dockers/ruby/check/solution.rb - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language