Skip to content

Add code and UAST buttons in results table #52

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

Merged
merged 3 commits into from
Jun 5, 2018
Merged

Add code and UAST buttons in results table #52

merged 3 commits into from
Jun 5, 2018

Conversation

smacker
Copy link
Contributor

@smacker smacker commented May 23, 2018

Based on #38
Fix: #23

screen shot 2018-05-23 at 16 27 06

screen shot 2018-05-23 at 16 27 18

screen shot 2018-05-23 at 16 27 25

@smacker smacker requested review from carlosms and bzz May 23, 2018 14:27
@@ -13,8 +15,15 @@ class ResultsTable extends Component {
switch (typeof v) {
case 'boolean':
return v.toString();
case 'string':
// assume any multiline string is code
if (v.split('\n').length > 1) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would this in JS work for both platform-dependent line endings?

Would it be possible to include a simple test for this function, so further refactoring would rely on it?

On the side-note, in case >= 1 could work for this, may be some kind of equivalent of .indeOf > 0 could be more performant..

Copy link
Contributor Author

@smacker smacker May 24, 2018

Choose a reason for hiding this comment

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

windows line ending is \r\n so it will work.
👍 for indexOf.

@bzz
Copy link
Contributor

bzz commented May 23, 2018

Also, here and in other pray rebase would make review life a bit easier.

@smacker
Copy link
Contributor Author

smacker commented May 24, 2018

changed split to indexOf.

Added simple test. Though I don't see any value in it. Current logic is completely wrong (for example commit messages can be displayed as code according to it). And I don't think it's possible to solve on frontend. But we agreed to go with this simple-wrong way for now.

@@ -14,8 +16,15 @@ class ResultsTable extends Component {
switch (typeof v) {
case 'boolean':
return v.toString();
case 'string':
// assume any multiline string is code
if (v.indexOf('\n') > 1) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be > -1? The way it is a multiline file with a blank line will not be detected.

@smacker
Copy link
Contributor Author

smacker commented Jun 4, 2018

@bzz @carlosms please another round.

Copy link
Contributor

@carlosms carlosms left a comment

Choose a reason for hiding this comment

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

👍

This was referenced Jun 5, 2018
Copy link
Contributor

@bzz bzz left a comment

Choose a reason for hiding this comment

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

👍

@smacker smacker merged commit ae44538 into src-d:master Jun 5, 2018
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.

4 participants