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

refactor [cdnjs] integration #1668

Merged
merged 2 commits into from
May 4, 2018
Merged

Conversation

chris48s
Copy link
Member

Found some time to get stuck into some refactoring. Lets start small and work up :)

this prevents us from throwing
TypeError: Cannot read property 'stack' of undefined
when we attempt to parse invalid json
@shields-ci
Copy link

Warnings
⚠️

This PR modified the server but none of the service tests. That's okay so long as it's refactoring existing code.

⚠️

This PR modified helper functions in lib/ but not accompanying tests. That's okay so long as it's refactoring existing code.

Messages
📖

✨ Thanks for your contribution to Shields, @chris48s!

📖

Thanks for contributing to our documentation. We ❤️ our documentarians!

Generated by 🚫 dangerJS

Copy link
Member

@RedSparr0w RedSparr0w left a comment

Choose a reason for hiding this comment

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

👍

@RedSparr0w
Copy link
Member

Nice work on this!

I was working on 1 the other week but got stuck as it had multiple regex, any idea how we would go about those badges?
eg: bitbucket & github

@chris48s
Copy link
Member Author

chris48s commented May 4, 2018

I was working on 1 the other week but got stuck as it had multiple regex, any idea how we would go about those badges?

Think we started chucking some ideas about here: #1358 (comment)

Broadly, if we've got currently got a service integration and there's currently one function that does both a version badge and a downloads badge, we should split that into 2 classes.

If that means we've got duplication to deal with, common code than then be shared either by defining shared helper functions which we call in multiple classes, or maybe in some cases inheritance might be a good pattern e.g:

class BaseGitHubService extends BaseService {
  // shared code goes here
}

class GitHubDownloads extends BaseGitHubService {
  // bla
}

class GitHubVersion extends BaseGitHubService {
  // bla
}

..or something like that.

Hopefully that's what you meant. I'll try a service like that with several endpoints next. It will probably be easier to discuss once we've got a concrete example.

@chris48s chris48s merged commit 8fcc13d into badges:master May 4, 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.

3 participants