lfglabs-dev / api.starknet.quest

starknet.quest rust backend
7 stars 28 forks source link

Clean the code #242

Closed Marchand-Nicolas closed 2 months ago

Marchand-Nicolas commented 3 months ago

There are some unused functions and structs. Also we use one or more deprecated functions. Please remove any unused code and update deprecated code.

Here are some example of problematic part of the repo: image image

Also in the Dockerfile there is an Inconsistency. We should not tell to "replace 8083 with your app's port" but rather 8080 image

I recommend setting up a good linter and checking compilation warnings to address all problems

Mgonzalez06 commented 2 months ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I have been working as a full-stack developer for two yearst. I have a strong focus on maintaining clean, efficient codebases and ensuring that all code adheres to best practices. This attention to detail makes me well-suited for tasks like removing unused functions and updating deprecated code. First time trying to contribute to the OD Hack. Ready to work and learn new things!

How I plan on tackling this issue

I would begin by setting up Clippy, a powerful linter for Rust, to identify potential improvements and issues in the codebase. While Clippy is excellent for suggesting optimizations and highlighting common errors, I will also seek additional tools or methods specifically designed to detect unused code and deprecated functions.

Once Clippy and any other relevant tools are configured, I would systematically review the flagged sections of code, removing or refactoring unnecessary or outdated elements. Additionally, I would review the Dockerfile and correct the inconsistency by standardizing the port to 8080, ensuring the project's documentation aligns with actual usage.

This approach ensures that all changes align with the project’s design standards, leading to a more maintainable and efficient codebase.

ScottyDavies commented 2 months ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am front end developer with 6 years experience. i have worked with microsoft on several projects, this will be my first time contributing to the hackathon and i am ready to work

How I plan on tackling this issue

I would approach this issue with following steps Identify Unused Code: Review the codebase and identify any unused functions, structs, or other entities. Use a linter or static code analysis tool to help detect and surface unused code. Remove Unused Code: Delete the identified unused functions, structs, and other entities from the codebase. Ensure that the removal of the unused code does not break any functionality or cause compilation errors. Identify Deprecated Code: Examine the codebase and check for any usage of deprecated functions or APIs. Consult the documentation or release notes of the dependencies and libraries used in the project to identify deprecated elements. Update Deprecated Code: Replace the usage of deprecated functions or APIs with their recommended alternatives. Ensure that the updated code maintains the same functionality and does not introduce any regressions. Address the Dockerfile Inconsistency: In the Dockerfile, update the instruction that tells the user to "replace 8083 with your app's port". Instead, set the port to a fixed value, such as 8080, which is a commonly used default for web applications. Ensure that the application is configured to listen on the correct port, and update any relevant configuration files or documentation. Set Up a Linter: Integrate a good linter into the development workflow to catch and prevent similar issues in the future. Configure the linter to enforce code style, detect unused code, and surface any other potential problems. Check Compilation Warnings: Ensure that the project compiles without any warnings. Address any remaining compilation warnings, as they can indicate potential issues or areas for improvement.

Mystic-Nayy commented 2 months ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hi i am a frontend/web3 developer

How I plan on tackling this issue

  1. Remove Unused Code: Identify and eliminate unused functions and structs in the codebase. Use a linter and check compilation warnings to ensure all unused code is addressed.

  2. Update Deprecated Functions: Replace deprecated functions with their updated counterparts to ensure the code remains compatible and efficient.

  3. Fix Dockerfile Inconsistency: Correct the Dockerfile to specify the correct port (8080), removing any misleading instructions.

  4. Set Up Linter: Implement a linter to automate code quality checks and catch any further issues related to unused code or deprecated functions.

SoarinSkySagar commented 2 months ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am a blockchain developer with a year of experience and I have experience in using and contributing to repos using Rust. I have developed Rust smart contracts, Rust projects and can definitely tackle this issue.

How I plan on tackling this issue

I will remove the said functions and check for more errors, so that the code is cleaner and easier to read. Also I will make sure that the project setup or runtime does not introduce any errors and will also update the documentation wherever required so that the codebase and documentation are in sync. Once assigned, I don't expect this issue to take very long time, and will be a fun time contributing!

SoarinSkySagar commented 2 months ago

Hi @Marchand-Nicolas, I have worked on similar code-cleanup issues too before, so please assign.

LukePereyra commented 2 months ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

hey team, I will like to work on this one! I'm a Frontend Engineer doing my firsts steps in web3

How I plan on tackling this issue

I will try to reproduce the warnings locally, also I will like a plugin in IntelliJ idea / vs Code to try to find more warnings by my side.

PoulavBhowmick03 commented 2 months ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I'm Poulav Bhowmick, a software engineer at Invisible Studios with a robust background in TypeScript, Rust, Solidity Cairo, fullstack development and blockchain technology. My experience includes building robust applications, optimizing functionalities and blockchain integration. I have actively participated in events and open source contributions, enhancing my capability to tackle real-world tech challenges. My projects can be viewed on my GitHub Profile and OnlyDust Profile. Plus I´m active member of Starknet community🇷.

How I plan on tackling this issue

To address the issues you've pointed out, I would recommend the following approach:

Remove unused code:

Go through the codebase and identify any unused functions, structs, or variables. Remove them to improve code clarity and maintainability.

Update deprecated functions:

Identify all deprecated function calls, like the NaiveDateTime::from_timestamp_opt in the first image. Replace them with their recommended alternatives. For example, use DateTime::from_timestamp instead of NaiveDateTime::from_timestamp_opt.

Set up and use a linter:

Install and configure a Rust linter like Clippy. Run the linter regularly to catch potential issues early.

Address compiler warnings:

Enable and pay attention to all compiler warnings. Systematically work through each warning, addressing the underlying issue.

Use cargo check:

Regularly run cargo check to identify compilation issues without full compilation.

Update dependencies:

Ensure all dependencies are up to date to avoid using deprecated functions from old library versions.

Refactor code:

Look for opportunities to refactor code to modern Rust idioms and best practices.

Document changes:

As you make changes, update any relevant documentation or comments to reflect the new code structure.

Write and update tests:

Ensure that all changes are covered by appropriate unit tests. Update existing tests that may be affected by the changes.

Continuous Integration:

Set up CI/CD pipelines that include linting, testing, and checking for unused code to catch issues early and automatically.

pheobeayo commented 2 months ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am a web3 frontend developer skilled in React and Next js. I am skilled in Typescript and Javascript

How I plan on tackling this issue

I will run through the codes.

Run the app

Remove unnecessary or repeated functions

DiegoB1911 commented 2 months ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I'm a Full Stack Developer with two years of experience. I'm also a member of Dojo Coding, where I'm learning new things such as Cairo and Web3. This is my first time participating in an OD Hack, and I'm eager to learn and contribute to new projects.

How I plan on tackling this issue

To solve the problem I woul do this: 1: Identify Unused Code 2: Remove Unused Functions and Structs 3: Update Deprecated Code Step 4: Final Review

onlydustapp[bot] commented 2 months ago

The maintainer Marchand-Nicolas has assigned pheobeayo to this issue via OnlyDust Platform. Good luck!

davedumto commented 2 months ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am a frontend web developer, very proficient in Javascript and typescript.

How I plan on tackling this issue

1: I will identify the unused code 2: Take out the unused code 3: Finally I will update the old code

Marchand-Nicolas commented 2 months ago

https://github.com/starknet-id/api.starknet.quest/pull/255