Showing 14 of 20 total issues
Method BuildModel
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
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
Open
function Register() {
const {REACT_APP_API_URL} = process.env;
const [userName, setUserName] = useState('');
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');
Method Up
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
Open
function SearchBar() {
const [searchbarActive, setSearchbarActive] = useState(false);
const [searchQuery, setSearchQuery] = useState("");
const [users, setUsers] = useState([]);
const [foundUsers, setFoundUsers] = useState([]);
Method RegisterUser
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
Open
function Login() {
const {REACT_APP_API_URL} = process.env;
const [userName, setUserName] = useState('');
const [password, setPassword] = useState('');
Function App
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function App() {
const logout = () => {
localStorage.removeItem("token");
window.location.href = "/";
Method LoginUser
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
[HttpPost("login")]
public async Task<IActionResult> LoginUser(UserLoginDTO user)
{
string error;
try
Method RegisterUser
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
[HttpPost("register")]
public async Task<IActionResult> RegisterUser(RegisterUserDTO user)
{
var error = string.Empty;
try
Method FollowUser
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
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
Open
return NoContent();
Function SearchBar
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
function SearchBar() {
const [searchbarActive, setSearchbarActive] = useState(false);
const [searchQuery, setSearchQuery] = useState("");
const [users, setUsers] = useState([]);
const [foundUsers, setFoundUsers] = useState([]);
- Read upRead up
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"