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

Add 'prefix' function to ipaddr filter. #243

Merged
merged 2 commits into from
Oct 15, 2018
Merged

Add 'prefix' function to ipaddr filter. #243

merged 2 commits into from
Oct 15, 2018

Conversation

mattcoley
Copy link
Collaborator

@mattcoley mattcoley commented Oct 14, 2018

Final request for ipaddr filter #236.

Returns the CIDR prefix of a valid IP address. If the IP address is invalid or the prefix is not a number it will return null. Example usage:
'1.0.0.1/24'|ipaddr('prefix') would return 24.

@codecov-io
Copy link

codecov-io commented Oct 14, 2018

Codecov Report

Merging #243 into master will increase coverage by 0.26%.
The diff coverage is 68.18%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #243      +/-   ##
============================================
+ Coverage     71.89%   72.15%   +0.26%     
- Complexity     1392     1441      +49     
============================================
  Files           220      220              
  Lines          4365     4478     +113     
  Branches        690      728      +38     
============================================
+ Hits           3138     3231      +93     
- Misses          992     1006      +14     
- Partials        235      241       +6
Impacted Files Coverage Δ Complexity Δ
...a/com/hubspot/jinjava/lib/filter/IpAddrFilter.java 70.96% <68.18%> (-13.65%) 12 <6> (+4)
...m/hubspot/jinjava/lib/filter/RejectAttrFilter.java 80.76% <0%> (-19.24%) 10% <0%> (+7%)
...bspot/jinjava/lib/filter/DateTimeFormatFilter.java 100% <0%> (ø) 8% <0%> (+4%) ⬆️
...n/java/com/hubspot/jinjava/lib/tag/TagLibrary.java 82.35% <0%> (+0.53%) 8% <0%> (+3%) ⬆️
...ain/java/com/hubspot/jinjava/lib/fn/Functions.java 84.41% <0%> (+2.51%) 55% <0%> (+24%) ⬆️
...m/hubspot/jinjava/lib/filter/SelectAttrFilter.java 75% <0%> (+4.62%) 15% <0%> (+7%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9adc8e1...2573c9e. Read the comment docs.

@boulter
Copy link
Contributor

boulter commented Oct 15, 2018

The only problem with this is that it creates more reasons to build uncacheable pages. :(

@mattcoley
Copy link
Collaborator Author

I can't see this being terribly useful on Hubspot-hosted pages. The original feature requester seems like he is using Jinjava directly.

@mattcoley mattcoley merged commit f72424b into master Oct 15, 2018
@mattcoley mattcoley deleted the ipaddr-filter branch October 15, 2018 15:44
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