Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Quality: Clean up Files.Actions phase 1 #12677

Merged
merged 14 commits into from Jul 6, 2023

Conversation

0x5bfa
Copy link
Member

@0x5bfa 0x5bfa commented Jun 21, 2023

Code Quality: Clean up Files.Actions

Motivation & Context

  • Improved readability

Warning
Please do not review code lines that I did not changed. I cannot make more diff. If there're more codes that are preferred to change, I will do that and mark that PR as the final one for that stage.

PR Checklist

  • Were these changes approved in an issue or discussion with the project maintainers? In order to prevent extra work, feature requests and changes to the codebase must be approved before the pull request will be reviewed. This prevents extra work for the contributors and maintainers.
    Related Feature: Improving Performance, optimizations, reliability and codebase  #4180
  • Did you build the app and test your changes?
  • Did you check for accessibility? You can use Accessibility Insights for this.
  • Did you remove any strings from the en-us resource file?
    • Did you search the solution to see if the string is still being used?
  • Did you implement any design changes to an existing feature?
    • Was this change approved?
  • Are there any other steps that were used to validate these changes?

Screenshots

None

Copy link
Contributor

@ferrariofilippo ferrariofilippo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should consider opening a different PR to refactor the initialization of context in most actions.
There are some little things that might be improved, but apart from that looks good

There are three missing ;:

  • DecompressArchive.cs at line 36
  • DecompressArchiveHere.cs at line 30
  • BaseSetAsAction.cs at line 32

src/Files.App/Actions/Content/PlayAllAction.cs Outdated Show resolved Hide resolved
src/Files.App/Actions/FileSystem/OpenItemAction.cs Outdated Show resolved Hide resolved
src/Files.App/Actions/FileSystem/OpenItemAction.cs Outdated Show resolved Hide resolved
src/Files.App/Actions/FileSystem/CutItemAction.cs Outdated Show resolved Hide resolved
src/Files.App/Actions/Display/GroupAction.cs Outdated Show resolved Hide resolved
src/Files.App/Actions/Display/GroupAction.cs Outdated Show resolved Hide resolved
@0x5bfa 0x5bfa closed this Jun 22, 2023
@0x5bfa 0x5bfa reopened this Jun 22, 2023
@0x5bfa
Copy link
Member Author

0x5bfa commented Jun 22, 2023

You should consider opening a different PR to refactor the initialization of context in most actions.

How come should I? I think it’s fine so far. Probably I will split up phase 1 PR into multiple PRs, so reviewers can review quickly and easily.

@ferrariofilippo
Copy link
Contributor

How come should I? I think it’s fine so far.

There are a lot of Actions which use
private readonly IContentApplicationContext context = Ioc.Default.GetRequired<IContentPageContext>();

I think the assignment should be moved to the constructor

@0x5bfa
Copy link
Member Author

0x5bfa commented Jun 23, 2023

I think the assignment should be moved to the constructor

All of them were moved.

@0x5bfa
Copy link
Member Author

0x5bfa commented Jun 23, 2023

Ready for final review.

Copy link
Contributor

@ferrariofilippo ferrariofilippo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There might be errors with tasks not awaited

src/Files.App/Actions/Global/OpenHelpAction.cs Outdated Show resolved Hide resolved
src/Files.App/Actions/Open/OpenSettingsAction.cs Outdated Show resolved Hide resolved
src/Files.App/Actions/Navigation/NewTabAction.cs Outdated Show resolved Hide resolved
src/Files.App/Actions/FileSystem/CreateShortcutAction.cs Outdated Show resolved Hide resolved
src/Files.App/Actions/Favorites/UnpinItemAction.cs Outdated Show resolved Hide resolved
src/Files.App/Actions/Favorites/PinItemAction.cs Outdated Show resolved Hide resolved
Copy link
Contributor

@ferrariofilippo ferrariofilippo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some more style-related issues, but I don't think they are blockers

src/Files.App/Actions/FileSystem/AddItemAction.cs Outdated Show resolved Hide resolved
src/Files.App/Actions/FileSystem/AddItemAction.cs Outdated Show resolved Hide resolved
src/Files.App/Actions/FileSystem/OpenItemAction.cs Outdated Show resolved Hide resolved
Copy link
Contributor

@ferrariofilippo ferrariofilippo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@0x5bfa
Copy link
Member Author

0x5bfa commented Jun 28, 2023

@yaira2 Ready to merge?

@yaira2
Copy link
Member

yaira2 commented Jun 28, 2023

@0x5bfa this looks like a big change, I'd like to get a second review before merging.

@0x5bfa
Copy link
Member Author

0x5bfa commented Jul 5, 2023

Should I have split up into like 3 PRs? I can do that instead of fixing conflicts and waiting reviews.

@yaira2
Copy link
Member

yaira2 commented Jul 5, 2023

We can do them together

@yaira2
Copy link
Member

yaira2 commented Jul 6, 2023

@0x5bfa besides for formatting, were there any other changes?

@0x5bfa
Copy link
Member Author

0x5bfa commented Jul 6, 2023

Change overview

  • Moved initializers to the constructors (i.e. dependency injection initializings)
  • Improved formatting
  • Updated return values of Execute(); (i.e. removing async for non-async) You can see this changing in ferrariofilippo's reviews

@yaira2 yaira2 merged commit 2a7ab2b into files-community:main Jul 6, 2023
1 check passed
@0x5bfa 0x5bfa deleted the 5bfa/cleanup-actions branch September 16, 2023 05:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants