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

Screenshot fixes #986

Merged
merged 4 commits into from
Nov 7, 2017
Merged

Conversation

pekkaklarck
Copy link
Member

@pekkaklarck pekkaklarck commented Nov 6, 2017

See messages of the individual commits for details.

This was a regression caused by new architecture.
In practice removed the support to automatically restore the old
configuration. Instead the old value is returned similarly as
with other "Set ..." keywords.

Fixes robotframework#985.
"keyword is deprecated and has no effect.")
previous = self.ctx.screenshot_root_directory
self.ctx.screenshot_root_directory = path
return previous

def _create_directory(self, path):
Copy link
Contributor

Choose a reason for hiding this comment

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

The method is used also in capture_page_screenshot method. It would be cleaner to move the _create_director method after the capture_page_screenshot methods.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is highly subjective. There's no rule to dictate how to order (helper) methods that would work well in all cases. A common approach, and also approach I generally prefer, is to have helper methods right after their first usage. I don't feel strongly about it here, though.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's highly subjective. The general style, before my time, with the library has been the helpers methods go after the keyword methods. Should we change the style?

Copy link
Member Author

Choose a reason for hiding this comment

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

Having all helper methods at the end in somewhat random order is, in my opinion, a bad practice. I like the stepdown rule recommended in the Clean Code book by Robert C. Martin: https://stackoverflow.com/questions/21881605/resharper-and-stylecop-vs-the-step-down-rule-clean-code

Even with that style there's a question how to handle same helper used multiple times. I prefer having the helper after the first usage, but here it's recommended to have it after the last: http://tidyjava.com/stepdown-rule/

Anyway, I don't think it is a good idea to do larger changes to the code just to change the style, but I'd be in favor of moving towards the stepdown rule. Perhaps having helpers after the last usage would be best, because it would be closer to the current approach.

Notice also that lot of this problem goes away when classes aren't too big. Some of the internal classes could still be split to smaller pieces.

@aaltat aaltat merged commit a5be394 into robotframework:master Nov 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants