casefoundation/weekly-roundup

View on GitHub

Showing 49 of 49 total issues

Function default has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function (props) {
  let headerLeft = (
    <div
      className="d-flex flex-row align-items-center"
      onClick={props.isCollapsed ? props.onExpand : props.onCollapse}
Severity: Minor
Found in client/src/components/Common/Section.js - About 1 hr to fix

    Function dynamicScrape has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const dynamicScrape = (url) => {
      return puppeteer.launch()
        .then((browser) => {
          // keep track of browsers to avoid memory leaks
          const id = uuid();
    Severity: Minor
    Found in server/lib/scraper.js - About 1 hr to fix

      Function Update has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        Update: function (id, name, roundup_order_shift) {
          return bookshelf.transaction(transacting => {
            return ArticleGroup.ById(id, transacting)
              .then((articleGroup) => {
                const oldOrder = articleGroup.get('roundup_order');
      Severity: Minor
      Found in server/lib/models/ArticleGroup.js - About 1 hr to fix

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

        const formatData = (metadata) => {
          const analyzedData = {
            title: '',
            source: '',
            published: '',
        Severity: Minor
        Found in server/lib/scraper.js - About 1 hr to fix

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

            render() {
              const articleGroup = this.props.articleGroup;
              const articleSections = [];
              this.props.articles.forEach(a => {
                articleSections.push(
          Severity: Minor
          Found in client/src/components/ArticleGroup/ArticleGroupSection.js - About 1 hr to fix

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

            const create = (req, res, next) => {
              let scrapeErrors;
              const url = req.body.url;
              const articlePromise =
                scrape(url)
            Severity: Minor
            Found in server/lib/routes/article.js - About 1 hr to fix

              Function roundupUpdate has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function roundupUpdate(id, subject, to, cc, preface) {
                let validationError;
                if (!validateString(subject, 0, 255, true)) {
                  validationError = `Invalid Subject. Must be 0-255 characters: ${subject}`;
                } else if (!validateString(preface, 0, 4166, true)) {
              Severity: Minor
              Found in client/src/actions/Roundup/RoundupActions.js - About 1 hr to fix

                Function render has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  render() {
                    return (
                      <Modal
                        okText="Save"
                        cancelText="Cancel"
                Severity: Minor
                Found in client/src/components/Users/UserModal.js - About 1 hr to fix

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

                  export function login(email, password) {
                    let validateError;
                    if (!validateEmail(email)) {
                      validateError = `Invalid Email Format: ${email}`;
                    } else if (!validatePassword(password)) {
                  Severity: Minor
                  Found in client/src/actions/Auth/AuthActions.js - About 1 hr to fix

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

                      Update: function (id, name, roundup_order_shift) {
                        return bookshelf.transaction(transacting => {
                          return ArticleGroup.ById(id, transacting)
                            .then((articleGroup) => {
                              const oldOrder = articleGroup.get('roundup_order');
                    Severity: Minor
                    Found in server/lib/models/ArticleGroup.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 updateArticle has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export function updateArticle(roundup, article) {
                      let updatedRoundup = roundup;
                    
                      // Update Entities
                      // Update Target Article
                    Severity: Minor
                    Found in client/src/schemas/ArticleSchema.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 Update has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                      Update: function (id, title, source, published, summary, url, article_group_id, group_order_shift) {
                        return bookshelf.transaction(transacting => {
                          return Article.ById(id, transacting)
                            .then((article) => {
                              const oldOrder = article.get('group_order');
                    Severity: Minor
                    Found in server/lib/models/Article.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 init has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    exports.init = (serve) => {
                      const app = express();
                      app.use(bodyParser.urlencoded({
                        extended: true,
                      }));
                    Severity: Minor
                    Found in server/lib/web.js - About 1 hr to fix

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

                        render() {
                          return (
                            <div id="login" className="w-100 h-100 d-flex flex-row justify-content-center align-items-center">
                              <div className="login-dialog bg-dark text-white p-3 text-center">
                                <h1>WeeklyRoundup</h1>
                      Severity: Minor
                      Found in client/src/containers/Auth/Login.js - About 1 hr to fix

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

                        export function updateArticle(roundup, article) {
                          let updatedRoundup = roundup;
                        
                          // Update Entities
                          // Update Target Article
                        Severity: Minor
                        Found in client/src/schemas/ArticleSchema.js - About 1 hr to fix

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

                          const mapDispatchToProps = dispatch => {
                            return {
                              // Roundup
                              deleteRoundup: (id) => {
                                dispatch(roundupDelete(id));
                          Severity: Minor
                          Found in client/src/containers/Roundups/View.js - About 1 hr to fix

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

                            export default function (props) {
                              // Mobile/Non-mobile styles
                              let style;
                              if (!props.isExpanded) {
                                style = {
                            Severity: Minor
                            Found in client/src/components/Layout/Sidebar.js - About 1 hr to fix

                              Function articleUpdate has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export function articleUpdate(id, title, url, published, source, summary, group_order_shift) {
                                let validateError;
                                if (!validateUrl(url, true)) {
                                  validateError = `Invalid Url Format: ${url}`;
                                } else if (!validateString(title, 0, 255, true)) {
                              Severity: Minor
                              Found in client/src/actions/Article/ArticleActions.js - About 1 hr to fix

                                Function default has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export default function (state = defaultState, action) {
                                  switch (action.type) {
                                    case SettingsActionType.SETTINGS_LOADING:
                                      return combine(state, {
                                        isLoading: true,
                                Severity: Minor
                                Found in client/src/reducers/SettingsReducer.js - About 1 hr to fix

                                  Function Create has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    Create: function (user_id) {
                                      return bookshelf.transaction((t) => {
                                        // Find User's most recent roundup
                                        return Roundup.ByUserId(user_id)
                                          .then((results) => {          
                                  Severity: Minor
                                  Found in server/lib/models/Roundup.js - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language