Skip to content

Conversation

@JimBobSquarePants
Copy link
Member

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following matches the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules 👮.
  • I have provided test coverage for my change (where applicable)

Description

Adds additional overloads to Image.Identify to handle both file paths and byte arrays.

/// </returns>
public static IImageInfo Identify(Configuration config, string filePath, out IImageFormat format)
{
config ??= Configuration.Default;
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't it be better to guard against null on places like this? A call in a form of Image.Identify(null, "blah", out blah) is not something I would encourage.

Copy link
Member Author

@JimBobSquarePants JimBobSquarePants Mar 14, 2020

Choose a reason for hiding this comment

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

I was following the existing pattern but you're right. I've updated the code to use null checks throughout. Turns out we were passing null in some instances internally!

Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we consider changing it? Maybe as part of #1110?

Copy link
Member Author

Choose a reason for hiding this comment

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

See above edit.

@codecov
Copy link

codecov bot commented Mar 14, 2020

Codecov Report

Merging #1146 into master will increase coverage by 0.01%.
The diff coverage is 92.06%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1146      +/-   ##
==========================================
+ Coverage   82.26%   82.27%   +0.01%     
==========================================
  Files         679      679              
  Lines       29256    29274      +18     
  Branches     3281     3278       -3     
==========================================
+ Hits        24067    24085      +18     
- Misses       4498     4500       +2     
+ Partials      691      689       -2
Flag Coverage Δ
#unittests 82.27% <92.06%> (+0.01%) ⬆️
Impacted Files Coverage Δ
src/ImageSharp/Image.FromStream.cs 89.58% <86.66%> (+2.08%) ⬆️
src/ImageSharp/Image.FromBytes.cs 93.5% <91.3%> (-0.78%) ⬇️
src/ImageSharp/Image.FromFile.cs 97.36% <96%> (+1.07%) ⬆️

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 3042f83...0873fe5. Read the comment docs.

Copy link
Member

@antonfirsov antonfirsov left a comment

Choose a reason for hiding this comment

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

LGTM

@JimBobSquarePants JimBobSquarePants merged commit 5ffdc47 into master Mar 15, 2020
@JimBobSquarePants JimBobSquarePants deleted the js/identify-overloads branch March 15, 2020 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants