ITUDevUps/devUps

View on GitHub

Showing 20 of 20 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        protected override void BuildTargetModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("ProductVersion", "7.0.4")
minitwit-backend/minitwit-backend.API/Migrations/MinitwitContextModelSnapshot.cs on lines 16..115

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 821.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        protected override void BuildModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("ProductVersion", "7.0.4")
minitwit-backend/minitwit-backend.API/Migrations/20230322012634_Initial.Designer.cs on lines 19..118

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 821.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Method BuildModel has 76 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        protected override void BuildModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("ProductVersion", "7.0.4")

    Method BuildTargetModel has 76 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            protected override void BuildTargetModel(ModelBuilder modelBuilder)
            {
    #pragma warning disable 612, 618
                modelBuilder
                    .HasAnnotation("ProductVersion", "7.0.4")

      Function Register has 60 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function Register() {
          const {REACT_APP_API_URL} = process.env;
          const [userName, setUserName] = useState('');
          const [email, setEmail] = useState('');
          const [password, setPassword] = useState('');
      Severity: Major
      Found in minitwit-frontend/src/pages/Register/Register.tsx - About 2 hrs to fix

        Method Up has 58 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                protected override void Up(MigrationBuilder migrationBuilder)
                {
                    migrationBuilder.CreateTable(
                        name: "message",
                        columns: table => new

          Function SearchBar has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function SearchBar() {
              const [searchbarActive, setSearchbarActive] = useState(false);
              const [searchQuery, setSearchQuery] = useState("");
              const [users, setUsers] = useState([]);
              const [foundUsers, setFoundUsers] = useState([]);
          Severity: Minor
          Found in minitwit-frontend/src/components/SearchField/SearchBar.tsx - About 1 hr to fix

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                            <input id="password" className="register-input" type="password" name="password" minLength={8}
                                   value={password} onChange={e => setPassword(e.target.value)} required/>
            Severity: Major
            Found in minitwit-frontend/src/pages/Register/Register.tsx and 1 other location - About 1 hr to fix
            minitwit-frontend/src/pages/Register/Register.tsx on lines 64..65

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 67.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Method RegisterUser has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                [HttpPost("register")]
                public async Task<IActionResult> RegisterUser([FromBody]ApiSimUser user, [FromQuery] int? latest)
                {
                    UpdateLatest(latest);
            
            

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                              <input id="repeatPassword" className="register-input" type="password" name="password" minLength={8}
                                     value={repeatPassword} onChange={e => setRepeatPassword(e.target.value)} required/>
              Severity: Major
              Found in minitwit-frontend/src/pages/Register/Register.tsx and 1 other location - About 1 hr to fix
              minitwit-frontend/src/pages/Register/Register.tsx on lines 59..60

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 67.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

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

              function Login() {
                  const {REACT_APP_API_URL} = process.env;
                  const [userName, setUserName] = useState('');
                  const [password, setPassword] = useState('');
              
              
              Severity: Minor
              Found in minitwit-frontend/src/pages/Login/Login.tsx - About 1 hr to fix

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

                function App() {
                
                    const logout = () => {
                        localStorage.removeItem("token");
                        window.location.href = "/";
                Severity: Minor
                Found in minitwit-frontend/src/App.tsx - About 1 hr to fix

                  Method LoginUser has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      [HttpPost("login")]
                      public async Task<IActionResult> LoginUser(UserLoginDTO user)
                      {
                          string error;
                          try
                  Severity: Minor
                  Found in minitwit-backend/minitwit-backend.API/Controllers/UserController.cs - About 1 hr to fix

                    Method RegisterUser has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        [HttpPost("register")]
                        public async Task<IActionResult> RegisterUser(RegisterUserDTO user)
                        {
                            var error = string.Empty;
                            try
                    Severity: Minor
                    Found in minitwit-backend/minitwit-backend.API/Controllers/UserController.cs - About 1 hr to fix

                      Method FollowUser has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          [HttpPost("fllws/{username}")]
                          public async Task<IActionResult> FollowUser([FromRoute]string username, [FromBody]ApiSimFollow follow, [FromQuery] int? latest)
                          {
                              UpdateLatest(latest);
                      
                      

                        Method Tweet has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            [HttpPost("msgs/{username}")]
                            public async Task<IActionResult> Tweet([FromRoute]string username, [FromBody]ApiSimTweet tweet, [FromQuery] int? latest)
                            {
                                UpdateLatest(latest);
                        
                        

                          Similar blocks of code found in 2 locations. Consider refactoring.
                          Open

                                          .Join(
                                              _context.Users,
                                              messages => messages.AuthorId,
                                              users => users.UserId,
                                              (message, user) => new TwitDTO
                          Severity: Minor
                          Found in minitwit-backend/minitwit-backend.API/Data/MessageRepository.cs and 1 other location - About 30 mins to fix
                          minitwit-backend/minitwit-backend.API/Data/MessageRepository.cs on lines 33..42

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 60.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Avoid too many return statements within this method.
                          Open

                                  return NoContent();
                          Severity: Major
                          Found in minitwit-backend/minitwit-backend.API/Controllers/SimApiController.cs - About 30 mins to fix

                            Similar blocks of code found in 2 locations. Consider refactoring.
                            Open

                                            .Join(
                                            _context.Users,
                                            messages => messages.AuthorId,
                                            users => users.UserId,
                                            (message, user) => new TwitDTO
                            Severity: Minor
                            Found in minitwit-backend/minitwit-backend.API/Data/MessageRepository.cs and 1 other location - About 30 mins to fix
                            minitwit-backend/minitwit-backend.API/Data/MessageRepository.cs on lines 17..26

                            Duplicated Code

                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                            Tuning

                            This issue has a mass of 60.

                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                            Refactorings

                            Further Reading

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

                            function SearchBar() {
                                const [searchbarActive, setSearchbarActive] = useState(false);
                                const [searchQuery, setSearchQuery] = useState("");
                                const [users, setUsers] = useState([]);
                                const [foundUsers, setFoundUsers] = useState([]);
                            Severity: Minor
                            Found in minitwit-frontend/src/components/SearchField/SearchBar.tsx - 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