ITUDevUps/devUps

View on GitHub

Showing 14 of 20 total issues

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

            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);
            
            

              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);
                        
                        

                          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

                            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