Lambda-School-Labs/kansha-fe

View on GitHub

Showing 43 of 187 total issues

Function Footer has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function Footer() {
    return (
        <footer className="landing-footer-container">
            <div>
                <section>
Severity: Minor
Found in src/components/Landing/Footer.jsx - About 1 hr to fix

    Function ReactionButton has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    export const ReactionButton = ({ reactions, rec_id, id, open, inModal }) => {
        const dispatch = useDispatch();
    
        // checks whether the current logged in user is among those who liekd the post
        const userReaction = useMemo(() => {
    Severity: Minor
    Found in src/components/Feed/ReactionButton.jsx - 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 ProfileTeamList has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    function ProfileTeamList({ myProfile }) {
        const [modal, setModal] = useState(false);
        const [teamDetails, setTeamDetails] = useState();
        const [loadingState] = useState();
        const [organizationMembers, setOrganizationMembers] = useState([]);
    Severity: Minor
    Found in src/components/Profile/ProfileTeamList.jsx - 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 Nav has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function Nav() {
        const [open, setOpen] = React.useState(false);
        return (
            <nav className="nav">
                <a
    Severity: Minor
    Found in src/components/Landing/Nav.jsx - About 1 hr to fix

      Function liveFeedListeners has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const liveFeedListeners = sse => dispatch => {
          // Listening for NEW events
          sse.addEventListener(FEED_EVENT_NEW_REC, event =>
              dispatch({
                  type: FEED_EVENT_NEW_REC,
      Severity: Minor
      Found in src/store/actions/feed-actions.js - About 1 hr to fix

        Function UserUpload has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function UserUpload() {
            const [user] = useState({
                first_name: '',
                last_name: '',
                email: '',
        Severity: Minor
        Found in src/components/UserUpload/UserUpload.jsx - About 1 hr to fix

          Function orgReducer has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const orgReducer = (state = initialState, action) => {
              switch (action.type) {
                  case ORG_UPDATE_LOGO_START:
                      return {
                          ...state,
          Severity: Minor
          Found in src/store/reducers/org-reducer.js - About 1 hr to fix

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

            const DropDown = ({
                children,
                setSelection,
                id,
                placeholder,
            Severity: Minor
            Found in src/components/Onboarding/DropDown.jsx - 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 getCroppedImg has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                const getCroppedImg = (image, crop, fileName) => {
                    const canvas = document.createElement('canvas');
                    const scaleX = image.naturalWidth / image.width;
                    const scaleY = image.naturalHeight / image.height;
                    canvas.width = crop.width;
            Severity: Minor
            Found in src/components/FileUpload/index.jsx - About 1 hr to fix

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

              export const timeAgo = timestamp => {
                  // get time in milliseconds
                  const currentTime = new Date(Date.now()).getTime();
                  const eventTime = new Date(timestamp).getTime()
              
              
              Severity: Minor
              Found in src/utils/timeago.js - About 1 hr to fix

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

                function LeadershipBoard(props) {
                    const [rank, setRank] = useState([]);
                    const [count, setCount] = useState(0);
                    const [limit, setLimit] = useState(5);
                
                
                Severity: Minor
                Found in src/components/AdminDashboard/reports/LeadershipBoard.jsx - About 1 hr to fix

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

                  function S1GetStarted() {
                      return (
                          <div data-test="S1Component">
                              <h1>Getting Started</h1>
                              <h5>You're only a few steps away from getting started on Kansha</h5>
                  Severity: Minor
                  Found in src/components/Onboarding/S1GetStarted.jsx - About 1 hr to fix

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

                    export const CommentButton = ({
                        comments,
                        id,
                        open,
                        handleComment,
                    Severity: Minor
                    Found in src/components/Feed/CommentButton.jsx - 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 OrgEmployees has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                    const OrgEmployees = ({
                        employee,
                        empButton,
                        addTeamMember,
                        id,
                    Severity: Minor
                    Found in src/components/AdminTeams/OrgEmployees.jsx - About 45 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

                    Avoid too many return statements within this function.
                    Open

                            return `${time} week${time > 1 ? 's' : ''} ago`;
                    Severity: Major
                    Found in src/utils/timeago.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return `${time} month${time > 1 ? 's' : ''} ago`;
                      Severity: Major
                      Found in src/utils/timeago.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                return `${time} year${time > 1 ? 's' : ''} ago`;
                        Severity: Major
                        Found in src/utils/timeago.js - About 30 mins to fix

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

                          export const App = () => {
                              const [init, setInit] = useState({
                                  fetched: false,
                                  error: false,
                                  onboarding: false,
                          Severity: Minor
                          Found in src/App.jsx - 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 S4AUserUpload has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function S4AUserUpload() {
                              const [uploadNow, setUploadNow] = useState('');
                              const [uploadMethod, setUploadMethod] = useState('');
                          
                              let history = useHistory();
                          Severity: Minor
                          Found in src/components/Onboarding/S4AUserUpload.jsx - 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 S4CUserUpload has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function S4CUserUpload({ user }) {
                              let history = useHistory();
                          
                              const [error, setError] = useState('');
                              const [file, setFile] = useState(null);
                          Severity: Minor
                          Found in src/components/Onboarding/S4CUserUpload.jsx - 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